I have been asked multiple times for this info in newsgroups and emails
to my joeware email and again at work yesterday so I wrote this up.
Thought I would share with the group here in case anyone cares.

---

First off the 64 bit Integer Time Values (Called Integer8) represents
the number of 100 nanosecond intervals between the time stamp and
January 1, 1601. Don't ask me why, this is just what it is, I am not
even going to attempt to explain it other than I wasn't around prior to
1969 so what happened with computers in 1601 is far outside my personal
scope of really caring. In fact I am not sure anything even existed then
because I didn't, it is up for debate.

1. Remove last 7 characters - Usually this will be all zeros but it may
be actual digits if you care to get down to 100 nanosecond accuracy, you
can figure it out.

2. Subtract off 11644473600

You are now at a value that is the number of seconds since since January
1, 1970. Again I will not explain even though I was around then. I still
wasn't at the point that I worried about time stamps on computers, I was
still flabbergasted that man had walked on the moon 6 short months
previously...

This value was targeted because there are functions out there that use
that format for time already and you can leverage them to convert to a
friendly time/date stamp such as ctime or localtime or gmtime.

So how to do this in perl??

Here is a quick perl script:

___t64.pl___
$t64=shift;
$t64=~s/(.+).{7,7}/\1/;
$t64-=11644473600;
($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat,
$isdst)=localtime($t64); $mon++; $year+=1900;
print "$mon/$mday/$year - $hour:$min:$sec  DST - $isdst\n";


When you run it it will produce something like:

C:\Temp>t64 127069827243689315
9/2/2003 - 9:25:24  DST - 1


Use as you wish. 

For other cool methods to play with those time fields in Perl check out
Robbie Allen's upcoming book - Active Directory Cookbook. :o)


   joe





List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to