PR c++/85515
[official-gcc.git] / libgo / runtime / go-nanotime.c
blobd221847adac2b6f578e418303ad7d7c29f2a60e7
1 // Copyright 2009 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 // Return current time in nanoseconds.
7 #include <sys/time.h>
9 #include "runtime.h"
11 int64 runtime_nanotime (void)
12 __attribute__ ((no_split_stack));
14 int64
15 runtime_nanotime (void)
17 struct timespec ts;
19 clock_gettime (CLOCK_MONOTONIC, &ts);
20 return (int64) ts.tv_sec * 1000000000 + (int64) ts.tv_nsec;