Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6962

Re: GetTimeZoneDiff() documentation missing

From "Jamal" <someone@example.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: GetTimeZoneDiff() documentation missing
Date 2014-06-15 21:31 -0400
Organization Aioe.org NNTP Server
Message-ID <lnlhd9$p34$1@speranza.aioe.org> (permalink)
References <lnda6q$fp4$1@speranza.aioe.org> <1402661063_1@vo.lu> <lnf96h$6bi$1@speranza.aioe.org> <c05vreF9ba0U1@mid.individual.net>

Show all headers | View raw


Hi Karl-Heinz,

I am not using those functions. Any samples on their use would be great.

I was able in getting the the UTC date and time of from the Epoch time.
The issue right now the local time based on different time zone.

Here is some code:

function ConvertEpochTime() as void pascal
local nDays, nEpochTime as int
  local nTimeZone := -5 as int   // EASTERN - 5 GMT
  local nSecondsInDay := 86400 as int
  local nLocal as int
  local lDaylight as logic
  local dUTCDate as date
  local dLocalDate as date

   nEpochTime := 1402680885 // 1318536660   // Unix EPOCH time in seconds 
from 1970.1.1
   // nEpochTime := 1402673020    // Unix EPOCH time in seconds from 
1970.1.1


   ? "Epoch Time", nEpochTime

    nDays := Days(nEpochTime)  + iif(nTimeZone > 0, 1, 0)  // From 1970

    lDaylight := IsDayLight()

    if nTimeZone > 0
        nLocal := nTimeZone + 24
    else
        nLocal := nTimeZone
    endif

    nLocal += iif(lDaylight, 1,0)  // adjust for DayLight

    ? nLocal

    dUTCDate := ConDate(1970,1,1) + Days(nEpochTime)    // get the UTC date
    ? "UTC Date: ", dUTCDate

    dLocalDate := ConDate(1970,1,1) + nDays    // get the date

    ? "LOCAL Date: ", dLocalDate


    ? "UTC Time: " ,  TString((nEpochTime - (Days(nEpochTime)  * 
nSecondsInDay)))
    ? "Local Time: ", TString((nEpochTime - (nDays * nSecondsInDay))+(nLocal 
* 3600))


WAIT
return
   FUNCTION IsDayLight() as logic PASCAL

   LOCAL tzi      is _WINTIME_ZONE_INFORMATION
   LOCAL dwZone   as DWORD
   LOCAL lDayLight  as logic

   dwZone := GetTimeZoneInformation(@tzi)

//    ? tzi.Bias
//    ? tzi.DaylightName
//    ? tzi.StandardName

   do CASE
   CASE dwZone == TIME_ZONE_ID_STANDARD
       lDayLight := false
   CASE dwZone == TIME_ZONE_ID_DAYLIGHT
        lDayLight := true
   ENDCASE

   RETURN lDayLight

Jamal

"Karl-Heinz"  wrote in message news:c05vreF9ba0U1@mid.individual.net...

Hi Jamal,

> I wrote some VO function to do the Unix Epoch time conversion which I am 
> still testing for accuracy for different time zones and daylight savings. 
> I did not have to use the GetTimeZoneDiff().

yes, i doubt that  GetTimeZoneDiff() does anything useful. Assuming the func
should return the bias in hours, it should return  in a german
environment -2, (UTC+01:00 + 1 hour daylight ). But if it would work as one
might expect it would fail in timezones like "Adelaide UTC+09:30 ". In such
cases the minutes are truncated because GetTimeZoneDiff() is declared as
INT. Anyway, are you using  in your VO code
"SystemTimeToTzSpecificLocalTime" and  "TzSpecificLocalTimeToSystemTime" to
calc unix- <> windows-datetimestamps ?  It seems that both funcs do not
require any TimeZone calculations, and that they are smart enough to use
automatically the correct bias on a given date. If you are interested i´ll
put some VO snippets  based on both funcs together.

regards
Karl-Heinz 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-12 18:39 -0400
  Re: GetTimeZoneDiff() documentation missing Camille Kater <katercam@pt.lu> - 2014-06-13 13:49 +0200
    Re: GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-13 12:34 -0400
      Re: GetTimeZoneDiff() documentation missing Camille Kater <katercam@pt.lu> - 2014-06-14 09:57 +0200
      Re: GetTimeZoneDiff() documentation missing "Karl-Heinz" <invalid@invalid.invalid> - 2014-06-15 18:27 +0200
        Re: GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-15 21:31 -0400
          Re: GetTimeZoneDiff() documentation missing "Karl-Heinz" <invalid@invalid.invalid> - 2014-06-16 14:45 +0200
            Re: GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-16 18:49 +0300
              Re: GetTimeZoneDiff() documentation missing "Karl-Heinz" <invalid@invalid.invalid> - 2014-06-17 08:49 +0200
        Re: GetTimeZoneDiff() documentation missing Camille Kater <katercam@pt.lu> - 2014-06-16 17:26 +0200
          Re: GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-16 14:08 -0400
            Re: GetTimeZoneDiff() documentation missing Camille Kater <katercam@pt.lu> - 2014-06-17 09:30 +0200
              Re: GetTimeZoneDiff() documentation missing "Jamal" <someone@example.com> - 2014-06-17 10:37 -0400
                Re: GetTimeZoneDiff() documentation missing Camille Kater <katercam@pt.lu> - 2014-06-18 09:34 +0200
          Re: GetTimeZoneDiff() documentation missing "Karl-Heinz" <invalid@invalid.invalid> - 2014-06-17 08:47 +0200

csiph-web