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