<?xml version="1.0" encoding="windows-1252"?>
<node id="906789" title="Re: Newbie, AD problem" created="2011-05-26 06:10:42" updated="2011-05-26 06:10:42">
<type id="11">
note</type>
<author id="472157">
bingos</author>
<data>
<field name="doctext">
&lt;p&gt;lastLogon &lt;i&gt;is stored as a large integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC). A value of zero means that the last logon time is unknown.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;I use an incantation like follows to get date type values out of AD:&lt;/p&gt;

&lt;code&gt;
sub msqtime2perl { # MicroSoft QuadTime to Perl
  my $foo = shift;
  my ($high,$low) = map { $foo-&gt;{ $_ } } qw(HighPart LowPart);
  return unless $high and $low;
  return ((unpack("L",pack("L",$low)) + unpack("L",pack("L",$high)) *
(2 ** 32))) / 10000000) - 11644473600;
}

if ( $userObject-&gt;{lastLogon} and $userObject-&gt;{lastLogon}-&gt;{HighPart} ) {
   $epochtime = msqtime2perl( $userObject-&gt;{lastLogon} );
}

&lt;/code&gt;</field>
<field name="root_node">
906766</field>
<field name="parent_node">
906766</field>
</data>
</node>
