Skip to content

Commit

Permalink
Fix TT-TAI
Browse files Browse the repository at this point in the history
The constant TT_MINUS_TAI_NSECS was being approximated by a double
instead of using a long long, resulting small errors.
  • Loading branch information
r-owen committed Sep 12, 2016
1 parent 9430b1c commit 1d4d179
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DateTime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static double const SEC_PER_DAY = 86400.0;
#endif

// Difference between Terrestrial Time and TAI.
static double const TT_MINUS_TAI_NSECS = 32184000000LL;
static long long const TT_MINUS_TAI_NSECS = 32184000000LL;

/* Leap second table as string.
*
Expand Down
1 change: 1 addition & 0 deletions tests/dateTime.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def testIsoUTCBasic(self):
for decPt in (".", ","): # "." or "," may be used as decimal point
dateStr = "2009{0}04{0}02T07{1}26{1}39{2}314159265Z".format(dateSep, timeSep, decPt)
ts = DateTime(dateStr, DateTime.UTC)
self.assertEqual(ts.nsecs(DateTime.TT), long(1238657265498159265))
self.assertEqual(ts.nsecs(DateTime.TAI), long(1238657233314159265))
self.assertEqual(ts.nsecs(DateTime.UTC), long(1238657199314159265))
self.assertEqual(ts.toString(DateTime.UTC), "2009-04-02T07:26:39.314159265Z")
Expand Down

0 comments on commit 1d4d179

Please sign in to comment.