VirtualBox

Changeset 72140 in vbox for trunk/src/VBox/Runtime/generic


Ignore:
Timestamp:
May 7, 2018 2:21:31 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122537
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/generic/RTTimeLocalExplode-generic.cpp

    r69111 r72140  
    3535RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec)
    3636{
    37     pTime = RTTimeExplode(pTime, pTimeSpec);
     37    RTTIMESPEC LocalTime = *pTimeSpec;
     38    int64_t LocalUTCOffset = RTTimeLocalDeltaNano(); /**< @todo this is obviously wrong. Need RTTimeLocalDeltaNanoFor(pTimeSpec); */
     39    RTTimeSpecAddNano(&LocalTime, LocalUTCOffset);
     40    pTime = RTTimeExplode(pTime, &LocalTime);
    3841    if (pTime)
    3942    {
    4043        pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
    41         pTime->offZone = RTTimeLocalDeltaNano() / (UINT64_C(1000000000)*3600); /** @todo this is obviously wrong. Need RTTimeLocalDeltaNanoFor(pTimeSpec); */
     44        pTime->offUTC = LocalUTCOffset / RT_NS_1MIN;
    4245    }
    4346    return pTime;
Note: See TracChangeset for help on using the changeset viewer.

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