Silverfrost Forums

Welcome to our forums

Date_and_Time for daylight saving

12 Oct 2011 12:36 #9074

This may be a note only, but I have tested DATE_AND_TIME and it reports the standard time zone, without any daylight saving modification. For Sydney today with daylight saving, where the local time is 11 hours ahead of UTC/GMT, VALUES(4) is reported as 600. I looked at the time zone in task bar and it reports '(GMT+10:00)' but selects automatically adjust for daylight saving changes. However, Values(5) is reporting the correct local hour for daylight saving time. I notice on the forum web site that before I log in, local time is reported with daylight saving time still in place for Grenwich (?) but reports my local time as GMT+10hr after I log in, which is out by 1 hour. I'm not sure how Windows XP implements daylight savings.

Should VALUES(4) = 660 (current local minutes agead of UTC/GMT) be the expected result or has XP fudged the time for daylight savings ?

The relevance of this is that FILES@ reports the dos_date and dos_time wrt UTC, which needs to be corrected to local time (potentially with the daylight savings adjustment at the time the file was last modified !!)

John

12 Oct 2011 7:02 #9075

I have not investigated this issue but here is the relevant code for DATE_AND_TIME from the FTN95 library...

    SYSTEMTIME time;
    GetLocalTime(&time);
    timezone = get_time_zone_bias();
    if (timezone == 0x80000001) timezone = 0;

where get_time_zone_bias is...

long get_time_zone_bias()
{
  TIME_ZONE_INFORMATION time_zone;
  long result;
  result= GetTimeZoneInformation(&time_zone);
  if(result == 0xffffffff)
  {
    return 0x80000001;  // -HUGE(0)
  }
  else
  {
    return -time_zone.Bias;
  }
}
Please login to reply.