See edit below for an updated response:
For NTP time, 64 bits are divided into seconds and fractions of a second. The top 32 bits are seconds. The bottom 32 bits are a fraction of a second. You get a share by dividing part of the fraction by 2 ^ 32.
So, the first step, convert to double.
If you like python, it's simple enough, I have not added any restrictions:
def to_seconds(h): return (h>>32) + ((float)(h&0xffffffff))/pow(2,32) >>> to_seconds(129518309081725000) 30155831.26845886
A time module can hide this float in a readable time format.
import time time.ctime(to_seconds(ntp_timestamp))
You will need to worry about where the timestamp was created. time.ctime suggests that you return by January 1, 1970. Therefore, if your program bases ntp time formats from the moment the program starts, you need to add to seconds to normalize the timestamp for ctime.
>>> time.ctime(to_seconds(129518309081725000)) 'Tue Dec 15 17:37:11 1970'
EDIT: PyGuy is right, the original timestamps are not ntp timestamps, they are Windows 64 bit timestamps.
Here is the new to_seconds method for converting a 100ns interval based on 1/1/1601 with an interval of 1970 seconds:
def to_seconds(h): s=float(h)/1e7
And a new conclusion:
import time time.ctime(to_seconds(129518309081725000)) 'Mon Jun 6 04:48:28 2011'
source share