Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double offset = pow(2, (i >> 20) - 0x3ff) * (((i & 0xfffff) + 0x100000) / (double) 0x100000);
- >>> def IntFromReal32(i):
- exponent = (i >> 20) - 0x3ff
- mantissa = (i & 0xfffff) + 0x100000
- return mantissa >> (20 - exponent)
- >>> testdata = range(0x40000000,0x40240000,0x10000) + range(0x40800000,0x40830000,0x10000) + [1088631936]
- >>> from datetime import date,timedelta
- >>> for i in testdata:
- print "0x%08x" % i, date(1899,12,30) + timedelta(IntFromReal32(i))
- 0x40000000 1900-01-01
- 0x40010000 1900-01-01
- 0x40020000 1900-01-01
- 0x40030000 1900-01-01
- 0x40040000 1900-01-01
- 0x40050000 1900-01-01
- 0x40060000 1900-01-01
- 0x40070000 1900-01-01
- 0x40080000 1900-01-02
- 0x40090000 1900-01-02
- 0x400a0000 1900-01-02
- 0x400b0000 1900-01-02
- 0x400c0000 1900-01-02
- 0x400d0000 1900-01-02
- 0x400e0000 1900-01-02
- 0x400f0000 1900-01-02
- 0x40100000 1900-01-03
- 0x40110000 1900-01-03
- 0x40120000 1900-01-03
- 0x40130000 1900-01-03
- 0x40140000 1900-01-04
- 0x40150000 1900-01-04
- 0x40160000 1900-01-04
- 0x40170000 1900-01-04
- 0x40180000 1900-01-05
- 0x40190000 1900-01-05
- 0x401a0000 1900-01-05
- 0x401b0000 1900-01-05
- 0x401c0000 1900-01-06
- 0x401d0000 1900-01-06
- 0x401e0000 1900-01-06
- 0x401f0000 1900-01-06
- 0x40200000 1900-01-07
- 0x40210000 1900-01-07
- 0x40220000 1900-01-08
- 0x40230000 1900-01-08
- 0x40800000 1901-05-26
- 0x40810000 1901-06-27
- 0x40820000 1901-07-29
- 0x40e33480 2007-09-07
- In [8]: time.strftime("%s", (2009, 3, 21, 1, 1, 0, 0,0,0))
- Out[8]: '1237590060'
- In [9]: time.strftime("%s", (2009, 3, 22, 1, 1, 0, 0,0,0))
- Out[9]: '1237676460'
- In [10]: print("%0x %0x" % (1237590060, 1237676460))
- 49c4202c 49c571ac
- date time abw xtr dbcap avabw avxtr avdbcap rtt timestamp
- 06/30/04 14:43:48 1.000 0.000 1.100 1.042 0.003 1.095 384.387 1088631828
- 06/30/04 14:45:36 1.100 0.000 1.100 1.051 0.003 1.096 376.408 1088631936
- 06/30/04 14:47:23 1.000 0.000 1.100 1.043 0.003 1.097 375.196 1088632043
Add Comment
Please, Sign In to add comment