# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1186388706 0 # Node ID d2b18c3b227c1a8189d82df8dde32117bdc4621c # Parent f2f7731c3eedbd9a40b3c76b51d9f4fe9d5a9cf1 [TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value. Use kCFAbsoluteTimeIntervalSince1970. diff -r f2f7731c3eed -r d2b18c3b227c src/mac.c --- 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)); }