hppa: Fix g++.dg/modules/bad-mapper-1.C on hpux
[official-gcc.git] / libgo / runtime / go-now.c
blobe1dcd180860ca2c67c58d18e1d80002f0f106e8e
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 runtime.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;