]> git.eshelyaron.com Git - emacs.git/commitdiff
[TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value.
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Mon, 6 Aug 2007 08:25:06 +0000 (08:25 +0000)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Mon, 6 Aug 2007 08:25:06 +0000 (08:25 +0000)
Use kCFAbsoluteTimeIntervalSince1970.

src/mac.c

index e81db1479b96ae6beae906a8a98c03964388d696..64af2407ab1a77a5f360caaa3ff53ee4975edb44 100644 (file)
--- a/src/mac.c
+++ b/src/mac.c
@@ -1127,18 +1127,15 @@ Lisp_Object
 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;
+  CFTimeInterval sec;
+  int high, low, microsec;
 
-  if (epoch == 0.0)
-    epoch = CFGregorianDateGetAbsoluteTime (epoch_gdate, NULL);
-
-  sec = CFDateGetAbsoluteTime (date) - epoch;
+  sec = CFDateGetAbsoluteTime (date) + kCFAbsoluteTimeIntervalSince1970;
   high = sec / 65536.0;
   low = sec - high * 65536.0;
+  microsec = (sec - floor (sec)) * 1000000.0;
 
-  return list3 (make_number (high), make_number (low), make_number (0));
+  return list3 (make_number (high), make_number (low), make_number (microsec));
 }