Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2009-10-13 06:26:33 +0400
committerEric Blake <eblake@redhat.com>2009-10-13 06:26:33 +0400
commitb8a35083c6c8ff967576ba6e9978323124506599 (patch)
tree4706e1f2df3c6dd2bf39017a50218ffa25ab5c04 /winsup/cygwin/hires.h
parent2fc007681e372282054c72dc95cee5f79e7d4b65 (diff)
Improve clock_gettime and utimensat resolution.
* hires.h (hires_ms): Change initime_us to initime_ns, with 10x more resolution. (hires_ms::nsecs): New prototype. (hires_ms::usecs, hires_ms::msecs, hires_ms::uptime): Adjust. * times.cc (systime_ns): New helper function. (hires_ms::prime): Use it for more resolution. (hires_ms::usecs): Change to... (hires_ms::nsecs): ...with more resolution. (clock_gettime): Use more resolution. (systime): Rewrite in terms of systime_ns. (timespec_to_filetime): Rewrite math to reflect true operation. * fhandler_disk_file.cc (utimens_fs): Use higher resolution.
Diffstat (limited to 'winsup/cygwin/hires.h')
-rw-r--r--winsup/cygwin/hires.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h
index 3c7bd2722..e91df0690 100644
--- a/winsup/cygwin/hires.h
+++ b/winsup/cygwin/hires.h
@@ -1,6 +1,6 @@
/* hires.h: Definitions for hires clock calculations
- Copyright 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
This file is part of Cygwin.
@@ -39,14 +39,15 @@ class hires_us : hires_base
class hires_ms : hires_base
{
- LONGLONG initime_us;
+ LONGLONG initime_ns;
void prime ();
public:
- LONGLONG usecs ();
- LONGLONG msecs () {return usecs () / 1000LL;}
+ LONGLONG nsecs ();
+ LONGLONG usecs () {return nsecs () / 10LL;}
+ LONGLONG msecs () {return nsecs () / 10000LL;}
UINT dmsecs () { return timeGetTime (); }
UINT resolution ();
- LONGLONG uptime () {return (usecs () - initime_us) / 1000LL;}
+ LONGLONG uptime () {return (nsecs () - initime_ns) / 10000LL;}
};
extern hires_ms gtod;