VirtualBox

Changeset 72140 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
May 7, 2018 2:21:31 PM (7 years ago)
Author:
vboxsync
Message:

IPRT/time: misc fixes (incorrect offUTC conversion sign, forgotten storing of offUTC, incorrect month/day calculation for first day of month, avoiding assertions when leap year needs to be recalulated) for local time, make RTTimeImplode process local time correctly, plus an implementation of RTTimeLocalNormalize and RTTimeConvertToZulu. Much improved testcase exercising overflow handling in the local time case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/time2-win.cpp

    r70345 r72140  
    7676                    pTime = RTTimeExplode(pTime, &LocalTime);
    7777                    if (pTime)
     78                    {
    7879                        pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
     80                        pTime->offUTC = (LocalTime - *pTimeSpec) / RT_NS_1MIN;
     81                    }
    7982                    return pTime;
    8083                }
     
    8891     */
    8992    LocalTime = *pTimeSpec;
    90     RTTimeSpecAddNano(&LocalTime, RTTimeLocalDeltaNano());
     93    int64_t LocalUTCOffset = RTTimeLocalDeltaNano();
     94    RTTimeSpecAddNano(&LocalTime, LocalUTCOffset);
    9195    pTime = RTTimeExplode(pTime, &LocalTime);
    9296    if (pTime)
     97    {
    9398        pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
     99        pTime->offUTC = LocalUTCOffset / RT_NS_1MIN;
     100    }
    94101    return pTime;
    95102}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette