From: YAMAMOTO Mitsuharu Date: Mon, 6 Aug 2007 08:25:06 +0000 (+0000) Subject: [TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value. X-Git-Tag: emacs-pretest-23.0.90~11581 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a6c76d726ab2a40769648588c5fac3573e702a72;p=emacs.git [TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value. Use kCFAbsoluteTimeIntervalSince1970. --- diff --git a/src/mac.c b/src/mac.c index e81db1479b9..64af2407ab1 100644 --- 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)); }