Page 1 of 2

OT - convert notations

Posted: 02 Jul 2013 17:17
by SkyFrontier
Hi, people.

Format 30304324-922355200 corresponds to date 2013-06-13 13:46

Format 30304315327317760corresponds to date 2013-06-13 13:36

Anyone has a clue on how I can convert any given date into such a format?

Thanks.

Re: OT - convert notations

Posted: 02 Jul 2013 17:34
by Marco
Can you tell us what software outputs such numbers?

Re: OT - convert notations

Posted: 02 Jul 2013 17:37
by SkyFrontier
Sure - Offline CD Browser.

Re: OT - convert notations

Posted: 02 Jul 2013 17:46
by Marco
Seems like some form of custom unit, and time is measured from a particular moment as offset, a-la NTFS.
9595037440 should be equal to 600 seconds / 10 minutes...
I recall having seen something similar in Winamp as total played time, however it is hex and far more incomprehensible. Didn't dig further...

Re: OT - convert notations

Posted: 02 Jul 2013 17:54
by SkyFrontier
There must be a hidden trick here as the second component of the first date is negative (so yes, there's definitely an offset point here!), despite it being 10 minutes later than the second date.
Any other hint is welcome, of course.

And Marco - thanks!

Re: OT - convert notations

Posted: 02 Jul 2013 21:37
by SkyFrontier
A bit more digging revealed

27846585119715840", "1980-01-01 03:00"; // oldest date allowed by XY for timestamping*
292789892085056256", "1999-06-30 15:30";
29368158-148728064", "2000-09-15 21:50"; // why this has a "-"?
30051159-1406863360", "2010-01-02 03:00"; //...just like this?
30191372658629888", "2011-11-30 03:00";
30308179913686016", "2013-07-02 18:37";

The previous data from first post is incorrect as now I see that "created" and "last used" columns are written inversely on .cdb file. So yes, it seems to be an increasing factor here but how to write it correctly? And more hideous... what's the mechanism behind the "-" appearance?

_________________
*it can be done with
::timestamp m, "1979-12-31 23:59:58";

Re: OT - convert notations

Posted: 02 Jul 2013 21:49
by admin

Re: OT - convert notations

Posted: 02 Jul 2013 22:10
by SkyFrontier
Many thanks for the tip, Don!
Current developments concerning time precision left me wondering but I see no way to convert lpFileTime (dwLowDateTime, dwHighDateTime) into lpSystemTime and vice versa, using XY scripting. Is there a way? Can it be provided, in case of a negative?

Re: OT - convert notations

Posted: 02 Jul 2013 22:17
by admin
No. I would end up writing a wrapper around the whole Windows API, I'm not that crazy.

And, now that you know "Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC)." what stops you from doing the math yourself. XY scripting has all the math functions you need. :P

Re: OT - convert notations

Posted: 02 Jul 2013 22:33
by SkyFrontier
admin wrote: ...what stops you from doing the math yourself. XY scripting has all the math functions you need. :P
being "1980-01-01 00:00" (03:00 was an inaccuracy from the software which insists shifting 00h > 03h, can't tell why!) the oldest date allowed by XY for timestamping, I couldn't experiment on actual files the calc script I'd write. Not impossible, but certainly not as easy as if I'd be allowed to

::timestamp m, "1600-12-31 23:59:58";*

...can you give me a hand here...?

_________________
*provided the 1980's date it's NOT a fat32 limitation, of course.

Re: OT - convert notations

Posted: 02 Jul 2013 23:16
by Marco
being "1980-01-01 00:00" (03:00 was an inaccuracy from the software which insists shifting 00h > 03h, can't tell why!) the oldest date allowed by XY for timestamping
Why you say so, are you working on FAT? Because on NTFS I can correctly timestamp a file back to 1601 (and this music comes to my mind...)

Re: OT - convert notations

Posted: 03 Jul 2013 00:08
by SkyFrontier
Yes, it's impossible for me to do the guessing on dwLow/HighDateTime without day zero to start studies.
Marco, can you give a take on this, please? Yes, I'm stuck on a FAT 32 file system and can't reach NTFS for the next days.
Bear in mind: lpFileTime into lpSystemTime and vice versa.

...and your song reminds me this one: http://www.youtube.com/watch?v=g_M_LAMaf0w, which I refuse to listen to these days.

Re: OT - convert notations

Posted: 03 Jul 2013 00:40
by Marco

Re: OT - convert notations

Posted: 03 Jul 2013 01:03
by SkyFrontier
Hm.
Errrrr...
Han...

I still can't see a way to convert those calculations into XY scripting, specially as (per my own initial observations and attempts) the farthest we could go is (like http://www.wolframalpha.com/input/?i=13 ... 0+*+100+ns clearly says) is a full amalgam of nanoseconds instead of a nice "2013-07-02 18:37" user readable format (not to mention the total lack of a clue on how to convert such date back into nanosecs!).

-and don't you dare to tell me that such conversion is 'pretty straightforward', right?
:mrgreen:

Strangely, that tune also reminds me Danny Boyle's Sunshine OST, a movie that was certainly made to be a full sensory experience.

Thanks for helping! Have a good nite.

Re: OT - convert notations

Posted: 03 Jul 2013 08:07
by admin
It softened my heart, next version you can do this:

Code: Select all

formatdate([date], [format], [shift_unit], [shift_num], [flags])
    flags:  1 = Date is FileTime ("high,low").
            2 = Localize (UTC to local time).

Code: Select all

echo formatdate("30304324,-922355200",,,,3);
(not officially documented)