[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

669.0. "UTC Time Routines" by CSC32::L_WEBER () Mon Jun 02 1997 11:09

      Fortran conference suggested I post this here, any help would be
      most appreciated.  Thanks.
    
      Customer is running VMS V6.1 on a VAX 6000-630 in a VAXcluster.

	$show log sys$timezone*/system
	"SYS$TIMEZONE_DIFFERENTIAL" = "-14400"

	$show time
	  30-MAY-1997 12:00:36

	$run test.exe   ( code shown below )
	30-MAY-1997 12:00:46.77

      Customer suspects UTC time routines not working properly because
	"The displayed time is the same as the current time.
	 This does not seem correct, I expect to see a time
         offset by 14400 seconds (4 hours)."

------------------------
	program test
        implicit none
        INCLUDE '($RMSDEF)'
        character*23    timbuf
        integer*4   status,sys$ascutc,timadr64(2)
        integer*4   utctim(4),sys$timcon,sys$bintim,sys$asctim
        status=SYS$ASCTIM (,%descr(timbuf),,)   !Get local time stamp
C         Convert to 64 bit time
        status=SYS$BINTIM (%descr(timbuf),%ref(timadr64)) 
C         Request convert to UTC time
        status=SYS$TIMCON (%ref(timadr64),%ref(utctim),%val(1)) 
C         Convert to ascii time to display
        status=SYS$ASCUTC (,%descr(timbuf),%ref(utctim),) 
        type *,timbuf
        CALL EXIT
        END
------------------------

	Regards, Larry Weber
        Customer Support Center - LST

        C970530-2846
T.RTitleUserPersonal
Name
DateLines
669.1as expected..COMEUP::SIMMONDSloose canonWed Jun 04 1997 02:3225
    Re: .0
    
|      Customer suspects UTC time routines not working properly because
|	"The displayed time is the same as the current time.
|	 This does not seem correct, I expect to see a time
|         offset by 14400 seconds (4 hours)."

    The properties of the routines being used are not understood by your
    Customer..
    
    sys$timcon()
    	produces 'UTC' (with the current TDF also encoded into the 128-bit
    	value)
    
    sys$ascutc()
    	takes the 128-bit value, extracts the UTC time part, applies the
    	encoded TDF and produces an ASCII representation of the result
    
    ..so the program given _should_ display something _very_ close to the
    current local time!
    
    John.
    
    Ps: The DECnet-Plus DTS Programming Guide describes other useful UTC
    	routines.