Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
use Time::Local ; use Math::BigInt ; sub SysToHex { my ($sec,$min,$hour,$mday,$mon,$year)= @_ ; my $sectime = timegm($sec,$min,$hour,$mday,$mon,$year) ; my @hexReg1601 ; # Result # Conversion to intervals of 100 nanosecondes since 1970 my $secsystime = Math::BigInt -> new( $sectime ) ; my $nano100= Math::BigInt -> new(10000000) ; my$nanosecsys = $secsystime -> bmul ( $nano100 ) ; # 100 ns intervals since 1601 and 1970 # obtained within windows by manualy # entering the date 01/01/1970 my $hex1970 = '0x019DB1DED53E8000' ; my $nano1970 = X2I ( $hex1970 ) ; # Total number of 100ns intervals my $sec1601 = $nano1970 + $nanosecsys ; my $hex1601 = I2X ( $sec1601) ; # This coma separated format is expected by the registry my @liste1601 = split ( "", $hex1601 ) ; unshift (@liste1601, "0" ) unless ( @liste1601 % 2 == 0 ) ; while (@liste1601) { push ( @hexReg1601, splice ( @liste1601, -2 ), "," ) } pop @hexReg1601 ; # Gets rid of the last coma return join ( "", @hexReg1601 ) ; } sub X2I { my $n = shift; $n = '0' x (4 - (length($n) % 4)) . $n; my $m = Math::BigInt->new(0); while ( my $o = substr($n, 0, 4, '') ) { $m = $m * 65536 + hex $o; } $m; } sub I2X { my $i = shift; my $hex = ''; do { my $mod = $i % 16; $hex .= sprintf("%x", $mod); } while $i = $i / 16; scalar reverse $hex; }

In reply to Win32 SystemTimeToFileTime by ZlR

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found