2010-12-03 05:34:57 +01: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 21:24:44 +01:00
|
|
|
// Return current time in nanoseconds.
|
2010-12-03 05:34:57 +01:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include "runtime.h"
|
|
|
|
|
2011-12-13 20:16:27 +01:00
|
|
|
int64 runtime_nanotime (void)
|
|
|
|
__attribute__ ((no_split_stack));
|
|
|
|
|
2010-12-03 05:34:57 +01:00
|
|
|
int64
|
|
|
|
runtime_nanotime (void)
|
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
|
2011-12-13 20:16:27 +01:00
|
|
|
gettimeofday (&tv, NULL);
|
2010-12-03 05:34:57 +01:00
|
|
|
return (int64) tv.tv_sec * 1000000000 + (int64) tv.tv_usec * 1000;
|
|
|
|
}
|