>>>>> "GS" == Gurpreet Singh <[email protected]> writes:
GS> Posting in some childish perl........please bear it
please don't post with line numbers. that makes it very hard to
cut/paste your code to try it out.
GS> 1 #!/usr/bin/perl
GS> 2 use warnings;
GS> 3 use strict;
GS> 4 use Time::HiRes qw(gettimeofday);
GS> 5 use Time::Local;
GS> 6 use Time::localtime;
GS> 7
GS> 8 my $t0 = gettimeofday;
GS> 9
GS> 10 my $forlocaltime = int($t0);
GS> 11 my $for_millisecond = int(($t0-$forlocaltime)*1000);
GS> 12
GS> 13 my $tm = localtime($forlocaltime);
GS> 14
GS> 15 printf ("Current Time- %02d:%02d:%02d:%03d %02d/%02d/%02d\n",
$tm->hour, $tm ->min,$tm->sec,$for_millisecond, $tm->mday, $tm->mon+1,
$tm->year+1900);
regardless of the need for millisecond info, use the POSIX::strftime
function as it does all of that formatting timestamps for you. and since
you pass it a string you can just interpolate the millisecond part into
that string.
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/