Open Source Databases

 View Only
  • 1.  gmtime()/time()

    Posted Fri March 05, 2021 06:49 AM

    Hi Team,

    Can anyone help me to understand if the below 2 time conversion functions handle the time difference when the Daylight Savings Time(DST) changes?

    time(timestamp time, mutable tuple<int32 sec, int32 min, int32 hour, int32 mday, int32 mon, int32 year, int32 wday, int32 yday, int32 isdst, int32 gmtoff, rstring zone> result)

    &

    gmtime(timestamp time, mutable tuple<int32 sec, int32 min, int32 hour, int32 mday, int32 mon, int32 year, int32 wday, int32 yday, int32 isdst, int32 gmtoff, rstring zone> result)

    If not, what is the feasible solution to convert the timestamp from any timezone to GMT timezone handling the DST changes?

    For example :

    During the DST (March 8th 2020 - November 1st 2020) GMT + 4

    The input timestamp : 2020/10/01 13:20:00 EST

    The output timestamp : 2020/10/01 17:20:00 GMT

    After DST ends for year 2020 GMT + 5

    The input timestamp : 2020/11/20 13:20:00 EST

    The output timestamp : 2020/11/20 18:20:00 GMT

    Thanks in advance






    #OpenSourceOfferings
    #Streams
    #Support
    #SupportMigration


  • 2.  RE: gmtime()/time()

    Posted Fri March 05, 2021 03:21 PM

    Those functions use the POSIX localtime_r and gmtime_r functions: https://linux.die.net/man/3/localtime_r

    And DST may or may not be accounted for. You'll need to check the isdst attribute of the tuple:

    A flag that indicates whether daylight saving time is in effect at the time described. The value is positive if daylight saving time is in effect, zero if it is not, and negative if the information is not available.




    #OpenSourceOfferings
    #Streams
    #Support
    #SupportMigration


  • 3.  RE: gmtime()/time()

    Posted Fri March 05, 2021 03:47 PM

    Beyond that though, those functions are mainly for breaking up a given timestamp to a tuple with different fields and not so much for converting between two timezones.

    I'm not familiar with SPL-provided or other included toolkit functions that easily do this outside of adding to the timestamp






    #OpenSourceOfferings
    #Streams
    #Support
    #SupportMigration