changeset 82288:d2b18c3b227c

[TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value. Use kCFAbsoluteTimeIntervalSince1970.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Mon, 06 Aug 2007 08:25:06 +0000
parents f2f7731c3eed
children 26e674df63d5
files src/mac.c
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/mac.c	Mon Aug 06 07:22:20 2007 +0000
+++ b/src/mac.c	Mon Aug 06 08:25:06 2007 +0000
@@ -1127,18 +1127,15 @@
 cfdate_to_lisp (date)
      CFDateRef date;
 {
-  static const CFGregorianDate epoch_gdate = {1970, 1, 1, 0, 0, 0.0};
-  static CFAbsoluteTime epoch = 0.0, sec;
-  int high, low;
-
-  if (epoch == 0.0)
-    epoch = CFGregorianDateGetAbsoluteTime (epoch_gdate, NULL);
-
-  sec = CFDateGetAbsoluteTime (date) - epoch;
+  CFTimeInterval sec;
+  int high, low, microsec;
+
+  sec = CFDateGetAbsoluteTime (date) + kCFAbsoluteTimeIntervalSince1970;
   high = sec / 65536.0;
   low = sec - high * 65536.0;
-
-  return list3 (make_number (high), make_number (low), make_number (0));
+  microsec = (sec - floor (sec)) * 1000000.0;
+
+  return list3 (make_number (high), make_number (low), make_number (microsec));
 }