chiark / gitweb /
Shun time(), since on Linux it is not monotonic with gettimeofday().
[disorder] / lib / syscalls.c
index 0d5dc187a0111eb637b32469951a769d50b27b60..b1756667fe22386283ea81f7054e2e7c9fcaf653 100644 (file)
@@ -148,6 +148,15 @@ void xgettimeofday(struct timeval *tv, struct timezone *tz) {
   mustnotbeminus1("gettimeofday", gettimeofday(tv, tz));
 }
 
+time_t xtime(time_t *whenp) {
+  struct timeval tv;
+
+  xgettimeofday(&tv, NULL);
+  if(whenp)
+    *whenp = tv.tv_sec;
+  return tv.tv_sec;
+}
+
 /*
 Local Variables:
 c-basic-offset:2