PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: AfxTime  (Read 223 times)

Richard Kelly

  • Senior Member
  • ***
  • Posts: 332
AfxTime
« on: June 16, 2020, 07:35:11 PM »

Using the latest WINFBE version, function AfxTimeZoneBias works as expected and when I use AfxTimeZoneDaylightBias I always get decimal 4294967236 or FFFFFFC4 as the return value.

I see that WORD is defined as uShort and wonder if that could be the source of the issue. -60 is FFC4.
« Last Edit: June 16, 2020, 07:59:40 PM by Richard Kelly »
Logged

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3268
Re: AfxTime
« Reply #1 on: June 16, 2020, 08:01:23 PM »

Change

PRIVATE FUNCTION AfxTimeZoneBias () AS DWORD
PRIVATE FUNCTION AfxTimeZoneDaylightBias () AS DWORD

to

PRIVATE FUNCTION AfxTimeZoneBias () AS LONG
PRIVATE FUNCTION AfxTimeZoneDaylightBias () AS LONG

and many thanks for reporting it.

Richard Kelly

  • Senior Member
  • ***
  • Posts: 332
Re: AfxTime
« Reply #2 on: June 16, 2020, 08:07:23 PM »

Jose...that cleared things up.
Logged

Richard Kelly

  • Senior Member
  • ***
  • Posts: 332
Re: AfxTime
« Reply #3 on: June 16, 2020, 09:27:36 PM »

You have:

AfxTimeZoneDaylightDay
AfxTimeZoneDaylightDayOfWeek
AfxTimeZoneDaylightHour
AfxTimeZoneDaylightMonth

For the transition from Standard to Daylight and I could not find:

AfxTimeZoneStandardDay
AfxTimeZoneStandardDayOfWeek
AfxTimeZoneStandardHour
AfxTimeZoneStandardMonth

for the transition from Daylight to Standard. Per MSDN, when the StandardDate.wMonth = 0, daylight savings is not observed.
Logged

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3268
Re: AfxTime
« Reply #4 on: June 16, 2020, 11:06:47 PM »

Code: [Select]
' ========================================================================================
' Returns the time zone identifier.
' Return values:
' - TIME_ZONE_ID_UNKNOWN (0)
'     Daylight saving time is not used in the current time zone, because there are no
'     transition dates or automatic adjustment for daylight saving time is disabled.
' - TIME_ZONE_ID_STANDARD (1)
'     The system is operating in the range covered by the StandardDate member of the
'     TIME_ZONE_INFORMATION structure.
' - TIME_ZONE_ID_DAYLIGHT (2)
'     The system is operating in the range covered by the DaylightDate member of the
'     TIME_ZONE_INFORMATION structure.
' If the function fails for other reasons, such as an out of memory error, it returns
' TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.
' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneId () AS DWORD
   DIM tzi AS TIME_ZONE_INFORMATION
   RETURN GetTimeZoneInformation(@tzi)
END FUNCTION
' ========================================================================================

' ========================================================================================
' Indicates whether the the system is operating in the range covered by the StandardDate
' member of the TIME_ZONE_INFORMATION structure.
' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneIsStandardSavingTime () AS BOOLEAN
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   RETURN (r = TIME_ZONE_ID_STANDARD)
END FUNCTION
' ========================================================================================

' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneStandardDay () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.StandardDate.wDay
END FUNCTION
' ========================================================================================

' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneStandardDayOfWeek () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.StandardDate.wDayOfWeek
END FUNCTION
' ========================================================================================

' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneStandardHour () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.StandardDate.wHour
END FUNCTION
' ========================================================================================

' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneStandardMonth () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.StandardDate.wMonth
END FUNCTION
' ========================================================================================
« Last Edit: June 16, 2020, 11:29:38 PM by Josť Roca »
Logged

Richard Kelly

  • Senior Member
  • ***
  • Posts: 332
Re: AfxTime
« Reply #5 on: June 17, 2020, 04:55:44 AM »

Sorry to be a pest, and could you also include these functions?

Code: [Select]
' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneStandardMinute () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.StandardDate.wMinute
END FUNCTION
' ========================================================================================

' ========================================================================================
PRIVATE FUNCTION AfxTimeZoneDaylightMinute () AS WORD
   DIM tzi AS TIME_ZONE_INFORMATION
   DIM r AS DWORD = GetTimeZoneInformation(@tzi)
   IF r = TIME_ZONE_ID_INVALID THEN RETURN 0
   RETURN tzi.DaylightDate.wMinute
END FUNCTION
' ========================================================================================
« Last Edit: June 17, 2020, 05:15:00 AM by Richard Kelly »
Logged

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3268
Re: AfxTime
« Reply #6 on: June 17, 2020, 10:37:11 AM »

Indeed. I already have updated the Git repository.

Richard Kelly

  • Senior Member
  • ***
  • Posts: 332
Re: AfxTime
« Reply #7 on: June 17, 2020, 07:57:11 PM »

Thank you once again... :)

Paul: Will these changes make into the next WINFBE release?
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: AfxTime
« Reply #8 on: June 18, 2020, 07:53:26 AM »

Yes, the changes will. I normally take the latest copy of Jose's WinFBX github and copy the files into the WinFBE Suite distribution.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer