public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: R0b0t1 <r030t1@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Cellphone VFAT datestamps versus linux datestamps
Date: Mon, 27 Aug 2018 23:07:51 -0500	[thread overview]
Message-ID: <CAAD4mYjJbgsL=gNGmvzL9SoMKTRnuWmUVjRdOovL2PdB+w27dw@mail.gmail.com> (raw)
In-Reply-To: <CAAD4mYiJDwL63He8PiUM+sJk_jXTXsU14Hpb7_5iKQ6U5YX6kg@mail.gmail.com>

On Mon, Aug 27, 2018 at 10:22 PM, R0b0t1 <r030t1@gmail.com> wrote:
> On Mon, Aug 27, 2018 at 9:48 PM, Walter Dnes <waltdnes@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()


  reply	other threads:[~2018-08-28  4:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28  2:48 [gentoo-user] Cellphone VFAT datestamps versus linux datestamps Walter Dnes
2018-08-28  3:22 ` R0b0t1
2018-08-28  4:07   ` R0b0t1 [this message]
2018-08-29  2:05   ` Walter Dnes
2018-08-28  3:41 ` james
2018-08-28  3:58 ` james
2018-08-28 14:07 ` Mike Gilbert
     [not found] <wrCeS-64V-1@gated-at.bofh.it>
2018-08-28  3:31 ` james
2018-08-29  2:39   ` Walter Dnes
2018-08-29  5:35     ` james
2018-08-29  7:22     ` Neil Bothwick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAD4mYjJbgsL=gNGmvzL9SoMKTRnuWmUVjRdOovL2PdB+w27dw@mail.gmail.com' \
    --to=r030t1@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox