Changeset 5969 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Dec 5, 2007 6:34:07 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 26546
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/cfgldr.cpp
r5523 r5969 60 60 #include <iprt/alloc.h> 61 61 62 /// @todo (dmik) until RTTime Implode and friends are done62 /// @todo (dmik) until RTTimeNormalize and friends are done 63 63 #include <time.h> 64 64 … … 2799 2799 } 2800 2800 2801 / / query as UTF8 string2801 /* query as UTF8 string */ 2802 2802 unsigned size = 0; 2803 2803 int rc = CFGLDRQueryString(hnode, pszName, NULL, 0, &size); … … 2810 2810 if (VBOX_SUCCESS(rc)) do 2811 2811 { 2812 / /Parse xsd:dateTime. The format is:2813 //'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?2814 // where zzzzzz is: (('+' | '-') hh ':' mm) | 'Z'2812 /* Parse xsd:dateTime. The format is: 2813 * '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)? 2814 * where zzzzzz is: (('+' | '-') hh ':' mm) | 'Z' */ 2815 2815 uint32_t yyyy = 0; 2816 2816 uint16_t mm = 0, dd = 0, hh = 0, mi = 0, ss = 0; … … 2822 2822 } 2823 2823 2824 / /currently, we accept only the UTC timezone ('Z'),2825 // ignoring fractional seconds, if present2824 /* currently, we accept only the UTC timezone ('Z'), 2825 * ignoring fractional seconds, if present */ 2826 2826 if (pszBuf[0] == 'Z' || 2827 2827 (pszBuf[0] == '.' && pszBuf[strlen(pszBuf)-1] == 'Z')) 2828 2828 { 2829 / / start with an error2829 /* start with an error */ 2830 2830 rc = VERR_PARSE_ERROR; 2831 2831 2832 2832 #if 0 2833 RTTIME time = { yyyy, mm, 0, 0, dd, hh, mm, ss, 0, 2833 RTTIME time = { yyyy, (uint8_t) mm, 0, 0, (uint8_t) dd, 2834 (uint8_t) hh, (uint8_t) mm, (uint8_t) ss, 0, 2834 2835 RTTIME_FLAGS_TYPE_UTC }; 2835 if (RTTimeNormalize (&time))2836 if (RTTimeNormalize (&time)) 2836 2837 { 2837 2838 RTTIMESPEC timeSpec; 2838 if (RTTimeImplode (&time, &timeSpec))2839 if (RTTimeImplode (&timeSpec, &time)) 2839 2840 { 2840 *pi64Value = RTTimeSpecGetMilli (&timeSpec);2841 *pi64Value = RTTimeSpecGetMilli (&timeSpec); 2841 2842 rc = VINF_SUCCESS; 2842 2843 } 2843 2844 } 2844 2845 #else 2845 /// @todo (dmik) until RTTime Implode and friends are done2846 /// @todo (dmik) until RTTimeNormalize and friends are done 2846 2847 int isdst = 0; 2847 2848 { … … 2860 2861 time.tm_year = yyyy - 1900; /* Year less 1900 */ 2861 2862 time_t t = mktime(&time); 2862 // mktime expects local time, but we supply it UTC, 2863 // do a trick to get the right time value 2863 /* mktime expects local time, but we supply it UTC, do a dirty 2864 * trick to get the right time value. Note that the trick doesn't 2865 * work when UTC + timezone_offset goes before midnight, 1.1.1970 2866 * (gmtime() will return NULL on failure) */ 2864 2867 tm *dummytm = gmtime(&t); 2865 dummytm->tm_isdst = isdst; 2866 time_t delta = t - mktime(dummytm); 2867 *pi64Value = t + delta; 2868 *pi64Value *= 1000; 2869 rc = VINF_SUCCESS; 2868 if (dummytm) 2869 { 2870 dummytm->tm_isdst = isdst; 2871 time_t delta = t - mktime(dummytm); 2872 *pi64Value = t + delta; 2873 *pi64Value *= 1000; 2874 rc = VINF_SUCCESS; 2875 } 2870 2876 #endif 2871 2877 } … … 2894 2900 RTTimeExplode(&time, &timeSpec); 2895 2901 #else 2896 /// @todo (dmik) until RTTime Implode and friends are done2902 /// @todo (dmik) until RTTimeNormalize and friends are done 2897 2903 time_t t = (time_t)(i64Value / 1000); 2898 2904 tm *ptm = gmtime(&t); … … 2914 2920 (uint16_t) time.u8Hour, (uint16_t) time.u8Minute, (uint16_t) time.u8Second); 2915 2921 #else 2916 /// @todo (dmik) until RTTime Implode and friends are done2922 /// @todo (dmik) until RTTimeNormalize and friends are done 2917 2923 time.tm_year, time.tm_mon, time.tm_mday, 2918 2924 time.tm_hour, time.tm_min, time.tm_sec);
Note:
See TracChangeset
for help on using the changeset viewer.