Rebase.
[official-gcc.git] / libgo / runtime / go-now.c
blobea8d070e9f3514f3fcaffde50c83a27169086918
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 #include <stddef.h>
6 #include <stdint.h>
7 #include <sys/time.h>
9 #include "runtime.h"
11 // Return current time. This is the implementation of time.now().
13 struct time_now_ret
14 now()
16 struct timeval tv;
17 struct time_now_ret ret;
19 gettimeofday (&tv, NULL);
20 ret.sec = tv.tv_sec;
21 ret.nsec = tv.tv_usec * 1000;
22 return ret;