runtime: don't stat a NULL filename
[official-gcc.git] / libgo / runtime / go-now.c
bloba45890bfd5aac00a04b3079782cbf0fb764368cf
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.walltime().
13 struct walltime_ret
15 int64_t sec;
16 int32_t nsec;
19 struct walltime_ret now(void) __asm__ (GOSYM_PREFIX "runtime.walltime")
20 __attribute__ ((no_split_stack));
22 struct walltime_ret
23 now(void)
25 struct timespec ts;
26 struct walltime_ret ret;
28 clock_gettime (CLOCK_REALTIME, &ts);
29 ret.sec = ts.tv_sec;
30 ret.nsec = ts.tv_nsec;
31 return ret;