Re: How create a time object of VBS in perl?

Bill Luebkert <[email protected]>
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <[email protected]>
On 9/18/2010 11:39 PM, Xiao Yafeng wrote:
>
> start_time = DateSerial( 2003, 01, 31) + TimeSerial( 6, 0, 0)
> data_array = lpd.getdata(id, start_time)

I think VB uses a different time format than most Windoze system times.

See if these help:
http://msdn.microsoft.com/en-us/library/3eaydw6e%28v=VS.80%29.aspx
http://msdn.microsoft.com/en-us/library/bbx05d0c%28VS.80%29.aspx
http://msdn.microsoft.com/en-us/library/ws25fd2z%28VS.80%29.aspx
http://msdn.microsoft.com/en-us/library/system.datetime%28v=VS.80%29.aspx

Time conversion:
http://msdn.microsoft.com/en-us/library/ms973825.aspx

I've converted various Windoze times (file time, system time) back
and forth to the standard epoch time we/UNIX use, but this time
(apparently DateTime format) appears to be different from file time
or system time.

# Epoch: seconds since January 1, 1970 (32 bits)
# FileTime: clunks (100-ns intervals) since January 1, 1601 (64 bits)
# System time array: Yr, Mon, DOW, Day, Hr, Min, Sec, Msec

-----------------------------------------------------------------------------

 From Date Time Structure writeup:

The DateTime value type represents dates and times with values ranging from
12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59
P.M., December 31, 9999 A.D. (C.E.)

Time values are measured in 100-nanosecond units called ticks, and a particular
date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.)
in the GregorianCalendar calendar.  For example, a ticks value of
31241376000000000L represents the date, Friday, January 01, 0100 12:00:00
midnight.  A DateTime value is always expressed in the context of an explicit
or default calendar.

-----------------------------------------------------------------------------

You could convert any time to the system time array format and add a field
for clunks or fractional msecs after the msec and write conversion routines
to convert back and forth to whatever time format you like.  Personally,
I find epoch time is the easiest to use and works for most situations since
it's a simple integer of seconds since 1970 and you can use a second integer
for fractional seconds/msecs.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.