1 |
On Mon, Aug 27, 2018 at 10:22 PM, R0b0t1 <r030t1@×××××.com> wrote: |
2 |
> On Mon, Aug 27, 2018 at 9:48 PM, Walter Dnes <waltdnes@××××××××.org> wrote: |
3 |
>> So I went to an event on Friday August 24th, and snapped some pics on |
4 |
>> my cellphone. Let's just say the datestamps were ridiculous. Is there |
5 |
>> a conversion algorithm or program to correct it? This may be a Windows |
6 |
>> versus linux thing. See attached listing... |
7 |
>> |
8 |
> |
9 |
> The high order bits are incrementing too quickly. I will check in a |
10 |
> bit, but I think you should parse them into epoch time and flip the |
11 |
> endianness. |
12 |
> |
13 |
|
14 |
You might mess with the below. Is there a seconds field? It doesn't |
15 |
quite work, potentially due to the missing info. It still seems too |
16 |
far off. Run with list as first argument. |
17 |
|
18 |
EXIF data may work, but I'd be worried the same mistake was made, |
19 |
assuming the people who wrote the camera software messed with the |
20 |
drivers. |
21 |
|
22 |
--- |
23 |
|
24 |
#!/usr/bin/env python3 |
25 |
import sys, os, struct |
26 |
from datetime import datetime |
27 |
from pprint import pprint |
28 |
|
29 |
def main(): |
30 |
for line in open(sys.argv[1], 'r'): |
31 |
date = ' '.join(line.strip().split()[3:6]) |
32 |
dt = datetime.strptime(date, '%b %d %Y') |
33 |
pprint(dt) |
34 |
ts = int(datetime.timestamp(dt)) |
35 |
pprint(ts) |
36 |
rts = struct.unpack('<I', ts.to_bytes(4, byteorder='big'))[0] |
37 |
pprint(rts) |
38 |
rtd = datetime.fromtimestamp(rts) |
39 |
pprint(rtd) |
40 |
|
41 |
if __name__ == '__main__': |
42 |
main() |