2010-12-03 04:34:57 +00:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2011-11-22 20:24:44 +00:00
|
|
|
// Return current time in nanoseconds.
|
2010-12-03 04:34:57 +00:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include "runtime.h"
|
|
|
|
|
2020-01-02 15:05:27 -08:00
|
|
|
int64 runtime_nanotime1 (void)
|
2011-12-13 19:16:27 +00:00
|
|
|
__attribute__ ((no_split_stack));
|
|
|
|
|
2010-12-03 04:34:57 +00:00
|
|
|
int64
|
2020-01-02 15:05:27 -08:00
|
|
|
runtime_nanotime1 (void)
|
2010-12-03 04:34:57 +00:00
|
|
|
{
|
2016-10-15 00:29:06 +00:00
|
|
|
struct timespec ts;
|
2010-12-03 04:34:57 +00:00
|
|
|
|
2016-10-15 00:29:06 +00:00
|
|
|
clock_gettime (CLOCK_MONOTONIC, &ts);
|
|
|
|
return (int64) ts.tv_sec * 1000000000 + (int64) ts.tv_nsec;
|
2010-12-03 04:34:57 +00:00
|
|
|
}
|