VirtualBox

Ignore:
Timestamp:
Aug 5, 2016 2:44:59 AM (8 years ago)
Author:
vboxsync
Message:

IPRT/RTSemMutex: use mnemonic constants when dealing with milli-,
micro- and nanoseconds. Same object code is generated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp

    r63004 r63027  
    8989            {
    9090                ts.tv_sec--;
    91                 ts.tv_nsec += 1000000000;
     91                ts.tv_nsec += RT_NS_1SEC;
    9292            }
    9393
     
    282282        gettimeofday(&tv, NULL);
    283283        ts.tv_sec = tv.tv_sec;
    284         ts.tv_nsec = tv.tv_usec * 1000;
     284        ts.tv_nsec = tv.tv_usec * RT_NS_1US;
    285285#else
    286286        clock_gettime(CLOCK_REALTIME, &ts);
     
    288288        if (cMillies != 0)
    289289        {
    290             ts.tv_nsec += (cMillies % 1000) * 1000000;
    291             ts.tv_sec  += cMillies / 1000;
    292             if (ts.tv_nsec >= 1000000000)
     290            ts.tv_nsec += (cMillies % RT_MS_1SEC) * RT_NS_1MS;
     291            ts.tv_sec  += cMillies / RT_MS_1SEC;
     292            if (ts.tv_nsec >= RT_NS_1SEC)
    293293            {
    294                 ts.tv_nsec -= 1000000000;
     294                ts.tv_nsec -= RT_NS_1SEC;
    295295                ts.tv_sec++;
    296296            }
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