` Printed Icetips Article

Icetips Article



Par2: Geting GMT/UTC from Windows
2003-05-27 -- Scott Ripley
 
Here's a completed source module that does the trick

  program
  map
    MODULE('Windows32')
      GetSystemTime(*SYSTEMTIME),PASCAL,RAW
    END
  end


SystemTimeType  GROUP,TYPE
wYear             USHORT
wMonth            USHORT
wDayOfWeek        USHORT
wDay              USHORT
wHour             USHORT
wMinute           USHORT
wSecond           USHORT
wMilliseconds     USHORT
                END

SystemTime      LIKE(SystemTimeType)

UTC_Date     LONG
UTC_Time     LONG

  CODE
  GetSystemTime(SystemTime)
  UTC_Date = DATE(SystemTime.WMONTH,SystemTime.WDAY,SystemTime.WYEAR)
  UTC_Time = (SystemTime.WHOUR * 360000) + |
            (SystemTime.WMINUTE * 6000) + |
            (SystemTime.WSECOND * 100)

  MESSAGE('Date =<9>'&FORMAT(UTC_Date,@d4) & |
         '|Time =<9>'&FORMAT(UTC_Time,@t6),'UTC Time')



Printed November 23, 2024, 2:23 am
This article has been viewed/printed 35225 times.