************************************************************************ FUNCTION CharToBin(lcBinString,llSigned) **************************************** *** Function: Binary Numeric conversion routine. *** Converts DWORD or Unsigned Integer string *** to Fox numeric integer value. *** Pass: lcBinString - String that contains the binary data *** llSigned - if .T. uses signed conversion *** otherwise value is unsigned (DWORD) *** Return: Fox number ************************************************************************ LOCAL m.i, lnWord lnWord = 0 FOR m.i = 1 TO LEN(lcBinString) lnWord = lnWord + (ASC(SUBSTR(lcBinString, m.i, 1)) * (2 ^ (8 * (m.i - 1)))) ENDFOR IF llSigned AND lnWord > 0x80000000 lnWord = lnWord - 1 - 0xFFFFFFFF ENDIF RETURN lnWord * wwAPI :: CharToBin+++ Rick ---
>>************************************************************************ >>FUNCTION GetTimeZone >>********************************* >>*** Function: Returns the TimeZone offset from GMT including >>*** daylight savings. Result is returned in minutes. >>************************************************************************ >> >>PUBLIC __TimeZone >>IF VARTYPE(__TimeZone) = "N" >> RETURN __TimeZone >>ENDIF >> >>DECLARE integer GetTimeZoneInformation IN Win32API ; >> STRING @ TimeZoneStruct >> >>lcTZ = SPACE(256) >> >>lnDayLightSavings = GetTimeZoneInformation(@lcTZ) >> >>lnOffset = CharToBin(SUBSTR(lcTZ,1,4),.T.) >> >>*** Subtract an hour if daylight savings is active >>IF lnDaylightSavings = 2 >> lnOffset = lnOffset - 60 >>ENDIF >> >>__TimeZone = lnOffset >> >>RETURN lnOffSet >> >> >>************************************************************************ >>* GetUtcTime >>**************************************** >>*** Function: Returns UTC time from local time >>*** Assume: >>*** Pass: >>*** Return: >>************************************************************************ >>FUNCTION GetUtcTime(ltTime) >>IF EMPTY(ltTime) >> ltTime = DATETIME() >>ENDIF >> >>RETURN ltTime + (GetTimeZone() * 60) >>ENDFUNC >>* GetUtcTime >> >>************************************************************************ >>* FromUtcTime >>**************************************** >>*** Function: Returns local time from UTC Time >>*** Assume: >>*** Pass: >>*** Return: >>************************************************************************ >>FUNCTION FromUtcTime(ltTime) >>RETURN ltTime - (GetTimeZone() * 60) >>ENDFUNC >>* FromUtcTime >>>>