aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2007-08-06 08:25:06 +0000
committerYAMAMOTO Mitsuharu2007-08-06 08:25:06 +0000
commita6c76d726ab2a40769648588c5fac3573e702a72 (patch)
tree30aa1e1ba9b539b53102dca69b11deb58a81444a /src/mac.c
parent75c23f5f85652f4b77ae568170f419f81fb7ea8b (diff)
downloademacs-a6c76d726ab2a40769648588c5fac3573e702a72.tar.gz
emacs-a6c76d726ab2a40769648588c5fac3573e702a72.zip
[TARGET_API_MAC_CARBON] (cfdate_to_lisp): Obtain microsec value.
Use kCFAbsoluteTimeIntervalSince1970.
Diffstat (limited to 'src/mac.c')
-rw-r--r--src/mac.c13
1 files changed, 5 insertions, 8 deletions
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
1127cfdate_to_lisp (date) 1127cfdate_to_lisp (date)
1128 CFDateRef date; 1128 CFDateRef date;
1129{ 1129{
1130 static const CFGregorianDate epoch_gdate = {1970, 1, 1, 0, 0, 0.0}; 1130 CFTimeInterval sec;
1131 static CFAbsoluteTime epoch = 0.0, sec; 1131 int high, low, microsec;
1132 int high, low;
1133 1132
1134 if (epoch == 0.0) 1133 sec = CFDateGetAbsoluteTime (date) + kCFAbsoluteTimeIntervalSince1970;
1135 epoch = CFGregorianDateGetAbsoluteTime (epoch_gdate, NULL);
1136
1137 sec = CFDateGetAbsoluteTime (date) - epoch;
1138 high = sec / 65536.0; 1134 high = sec / 65536.0;
1139 low = sec - high * 65536.0; 1135 low = sec - high * 65536.0;
1136 microsec = (sec - floor (sec)) * 1000000.0;
1140 1137
1141 return list3 (make_number (high), make_number (low), make_number (0)); 1138 return list3 (make_number (high), make_number (low), make_number (microsec));
1142} 1139}
1143 1140
1144 1141