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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // Copyright 2009 The Go Authors. All rights reserved.
kono
parents:
diff changeset
2 // Use of this source code is governed by a BSD-style
kono
parents:
diff changeset
3 // license that can be found in the LICENSE file.
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 // Return current time in nanoseconds.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 #include <sys/time.h>
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 #include "runtime.h"
kono
parents:
diff changeset
10
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
11 int64 runtime_nanotime1 (void)
111
kono
parents:
diff changeset
12 __attribute__ ((no_split_stack));
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 int64
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
15 runtime_nanotime1 (void)
111
kono
parents:
diff changeset
16 {
kono
parents:
diff changeset
17 struct timespec ts;
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 clock_gettime (CLOCK_MONOTONIC, &ts);
kono
parents:
diff changeset
20 return (int64) ts.tv_sec * 1000000000 + (int64) ts.tv_nsec;
kono
parents:
diff changeset
21 }