Mercurial > hg > CbC > CbC_gcc
annotate libgo/runtime/go-nanotime.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
rev | line source |
---|---|
111 | 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. | |
4 | |
5 // Return current time in nanoseconds. | |
6 | |
7 #include <sys/time.h> | |
8 | |
9 #include "runtime.h" | |
10 | |
145 | 11 int64 runtime_nanotime1 (void) |
111 | 12 __attribute__ ((no_split_stack)); |
13 | |
14 int64 | |
145 | 15 runtime_nanotime1 (void) |
111 | 16 { |
17 struct timespec ts; | |
18 | |
19 clock_gettime (CLOCK_MONOTONIC, &ts); | |
20 return (int64) ts.tv_sec * 1000000000 + (int64) ts.tv_nsec; | |
21 } |