HP OpenVMS Systemsask the wizard |
The Question is:
I am trying to convert a date-time format from a file downloaded from the
Alpha to a PC (Windows NT 4.0). The file is downloaded via FTP. The file is
in an RMS format. I am having a problem with a "time_t" (4 bytes) format for
which I am not familiar with. I am not able to get to any VMS documentation
to figure it out, so I have been guessing ( and not very well!) Do you know
if this is a "seconds since 1/1/1970" type format or a "yyyddd" type format?
I have to convert to a SQL Server datetime which is a
long dtdays /* # of days since 1/1/1900 */
Unsigned long dttime /* 300ths of a second since
midnight */
Thanks for your help
The Answer is :
The question you ask is does not appear to be VMS specific.
The 'time_t' format we know of is a C type for a 4 byte integer
declared in types.h as time (in seconds) elapsed past epoch
(00:00:00, January 1, 1970)
> long dtdays /* # of days since 1/1/1900 */
> Unsigned long dttime /* 300ths of a second since midnight */
To convert to the above time, you need something like (untested)
sql.dtdays = (int) t_time / 86400 ; /* number of seconds in a day */
sql.dttime = 300 * ( (int) t_time % 86400 )
hth,
Hein.
|