Changeset 72094 in vbox
- Timestamp:
- May 3, 2018 2:11:50 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/time/time.cpp
r71268 r72094 712 712 && pTime->offUTC) 713 713 { 714 int32_t offUTCHour = pTime->offUTC / 60; 715 int32_t offUTCMinute = pTime->offUTC % 60; 716 char chSign; 717 Assert(pTime->offUTC <= 840 && pTime->offUTC >= -840); 718 if (pTime->offUTC >= 0) 714 int32_t offUTC = pTime->offUTC; 715 Assert(offUTC <= 840 && offUTC >= -840); 716 char chSign; 717 if (offUTC >= 0) 719 718 chSign = '+'; 720 719 else 721 720 { 722 721 chSign = '-'; 723 offUTCMinute = -offUTCMinute; 724 offUTCHour = -offUTCHour; 722 offUTC = -offUTC; 725 723 } 724 uint32_t offUTCHour = (uint32_t)offUTC / 60; 725 uint32_t offUTCMinute = (uint32_t)offUTC % 60; 726 726 cch = RTStrPrintf(psz, cb, 727 "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02d% 02d",727 "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02d%:02d", 728 728 pTime->i32Year, pTime->u8Month, pTime->u8MonthDay, 729 729 pTime->u8Hour, pTime->u8Minute, pTime->u8Second, pTime->u32Nanosecond, 730 730 chSign, offUTCHour, offUTCMinute); 731 731 if ( cch <= 15 732 || psz[cch - 5] != chSign)732 || psz[cch - 6] != chSign) 733 733 return NULL; 734 734 } … … 885 885 || *pszString == '-') 886 886 { 887 rc = RTStrToInt32Ex(pszString, (char **)&pszString, 10, &pTime->offUTC); 887 int8_t cUtcHours = 0; 888 rc = RTStrToInt8Ex(pszString, (char **)&pszString, 10, &cUtcHours); 888 889 if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_CHARS && rc != VWRN_TRAILING_SPACES) 890 return NULL; 891 uint8_t cUtcMin = 0; 892 if (*pszString == ':') 893 { 894 rc = RTStrToUInt8Ex(pszString + 1, (char **)&pszString, 10, &cUtcMin); 895 if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_SPACES) 896 return NULL; 897 } 898 else if (*pszString && !RT_C_IS_BLANK(*pszString)) 899 return NULL; 900 if (cUtcHours >= 0) 901 pTime->offUTC = cUtcHours * 60 + cUtcMin; 902 else 903 pTime->offUTC = cUtcHours * 60 - cUtcMin; 904 if (RT_ABS(pTime->offUTC) > 840) 889 905 return NULL; 890 906 }
Note:
See TracChangeset
for help on using the changeset viewer.