Changeset 8780 for trunk/src/kernel32/time.cpp
- Timestamp:
- Jun 26, 2002, 12:18:27 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/time.cpp
r8777 r8780 1 /* $Id: time.cpp,v 1.2 1 2002-06-26 07:42:35sandervl Exp $ */1 /* $Id: time.cpp,v 1.22 2002-06-26 10:18:27 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Win32 time/date API functions 5 5 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)6 * Copyright 1998-2002 Sander van Leeuwen (sandervl@xs4all.nl) 7 7 * Copyright 1999 Christoph Bratschi (cbratschi@datacomm.ch) 8 8 * 9 * Copyright 1996 Alexandre Julliard10 * Copyright 1995 Martin von Loewis11 * Copyright 1998 David Lee Lambert12 13 9 * 14 10 * Project Odin Software License can be found in LICENSE.TXT … … 33 29 #include <time.h> 34 30 #include "unicode.h" 31 #include "oslibtime.h" 35 32 36 33 #define DBG_LOCALLOG DBG_time 37 34 #include "dbglocal.h" 38 35 39 //****************************************************************************** 40 //****************************************************************************** 41 void WIN32API GetLocalTime(LPSYSTEMTIME arg1) 42 { 43 O32_GetLocalTime(arg1); 44 } 45 //****************************************************************************** 46 //****************************************************************************** 47 BOOL WIN32API SetLocalTime(const SYSTEMTIME * arg1) 48 { 49 return O32_SetLocalTime(arg1); 50 } 51 //****************************************************************************** 52 //****************************************************************************** 53 BOOL WIN32API FileTimeToDosDateTime(const FILETIME * arg1, LPWORD arg2, 54 LPWORD arg3) 55 { 56 return O32_FileTimeToDosDateTime(arg1, arg2, arg3); 57 } 58 59 //****************************************************************************** 60 //****************************************************************************** 61 BOOL WIN32API FileTimeToLocalFileTime(const FILETIME * utcft, LPFILETIME localft) 62 { 63 return O32_FileTimeToLocalFileTime(utcft,localft); 64 } 65 //****************************************************************************** 66 //****************************************************************************** 67 BOOL WIN32API LocalFileTimeToFileTime(const FILETIME * arg1, LPFILETIME arg2) 68 { 69 dprintf(("KERNEL32: LocalFileTimeToFileTime\n")); 70 return O32_LocalFileTimeToFileTime(arg1, arg2); 71 } 72 //****************************************************************************** 73 //****************************************************************************** 74 BOOL WIN32API FileTimeToSystemTime(const FILETIME * arg1, LPSYSTEMTIME arg2) 75 { 76 return O32_FileTimeToSystemTime(arg1, arg2); 77 } 78 //****************************************************************************** 79 //****************************************************************************** 80 BOOL WIN32API DosDateTimeToFileTime(WORD arg1, WORD arg2, LPFILETIME arg3) 81 { 82 return O32_DosDateTimeToFileTime(arg1, arg2, arg3); 83 } 84 //****************************************************************************** 85 //****************************************************************************** 86 DWORD WIN32API GetTimeZoneInformation(LPTIME_ZONE_INFORMATION arg1) 87 { 88 return O32_GetTimeZoneInformation(arg1); 36 37 //****************************************************************************** 38 //File time (UTC) to MS-DOS date & time values (also UTC) 39 //****************************************************************************** 40 BOOL WIN32API FileTimeToDosDateTime(const FILETIME *lpFileTime, LPWORD lpDosDate, 41 LPWORD lpDosTime) 42 { 43 if(lpFileTime == NULL || lpDosDate == NULL || lpDosTime == NULL ) 44 { 45 SetLastError(ERROR_INVALID_PARAMETER); 46 return FALSE; 47 } 48 return O32_FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime); 49 } 50 //****************************************************************************** 51 //File time (UTC) to local time 52 //****************************************************************************** 53 BOOL WIN32API FileTimeToLocalFileTime(const FILETIME *lpFileTime, LPFILETIME lpLocalTime) 54 { 55 if(lpFileTime == NULL || lpLocalTime == NULL || lpFileTime == lpLocalTime) 56 { 57 SetLastError(ERROR_INVALID_PARAMETER); 58 return FALSE; 59 } 60 return O32_FileTimeToLocalFileTime(lpFileTime, lpLocalTime); 61 } 62 //****************************************************************************** 63 //Local time to File time (UTC) 64 //****************************************************************************** 65 BOOL WIN32API LocalFileTimeToFileTime(const FILETIME *lpLocalFileTime, 66 LPFILETIME lpFileTime) 67 { 68 BOOL ret; 69 70 if(!lpLocalFileTime || !lpFileTime || lpLocalFileTime == lpFileTime) { 71 dprintf(("!WARNING!: invalid parameter")); 72 SetLastError(ERROR_INVALID_PARAMETER); 73 return FALSE; 74 } 75 dprintf(("KERNEL32: LocalFileTimeToFileTime %x%x", lpLocalFileTime->dwHighDateTime, lpLocalFileTime->dwLowDateTime)); 76 ret = O32_LocalFileTimeToFileTime(lpLocalFileTime, lpFileTime); 77 dprintf(("KERNEL32: LocalFileTimeToFileTime %x%x -> %d", lpFileTime->dwHighDateTime, lpFileTime->dwLowDateTime, ret)); 78 return ret; 79 } 80 //****************************************************************************** 81 //File time (UTC) to System time (UTC) 82 //****************************************************************************** 83 BOOL WIN32API FileTimeToSystemTime(const FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) 84 { 85 BOOL ret; 86 87 if(lpFileTime == NULL || lpSystemTime == NULL) 88 { 89 SetLastError(ERROR_INVALID_PARAMETER); 90 return FALSE; 91 } 92 93 ret = O32_FileTimeToSystemTime(lpFileTime, lpSystemTime); 94 dprintf(("time: %d-%d-%d %d:%d:%d", lpSystemTime->wDay, lpSystemTime->wMonth, lpSystemTime->wYear, lpSystemTime->wHour, lpSystemTime->wMinute, lpSystemTime->wSecond)); 95 return ret; 96 } 97 //****************************************************************************** 98 //MS-DOS date & time values (UTC) to File time (also UTC) 99 //****************************************************************************** 100 BOOL WIN32API DosDateTimeToFileTime(WORD wDosDate, WORD wDosTime, LPFILETIME pFileTime) 101 { 102 dprintf(("%x %x", wDosDate, wDosTime)); 103 104 if(pFileTime == NULL) { 105 SetLastError(ERROR_INVALID_PARAMETER); 106 return FALSE; 107 } 108 return O32_DosDateTimeToFileTime(wDosDate, wDosTime, pFileTime); 89 109 } 90 110 //****************************************************************************** … … 92 112 DWORD WIN32API GetTickCount(void) 93 113 { 94 //// dprintf(("KERNEL32: GetTickCount\n")); 95 return O32_GetTickCount(); 96 } 97 //****************************************************************************** 98 //****************************************************************************** 99 void WIN32API GetSystemTime(LPSYSTEMTIME arg1) 100 { 101 O32_GetSystemTime(arg1); 102 } 103 //****************************************************************************** 104 //****************************************************************************** 105 BOOL WIN32API SystemTimeToFileTime(const SYSTEMTIME * arg1, 106 LPFILETIME arg2) 107 { 108 return O32_SystemTimeToFileTime(arg1, arg2); 109 } 110 //****************************************************************************** 111 //****************************************************************************** 112 BOOL WIN32API SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION arg1, 113 LPSYSTEMTIME arg2, 114 LPSYSTEMTIME arg3) 115 { 116 return O32_SystemTimeToTzSpecificLocalTime(arg1, arg2, arg3); 117 } 118 //****************************************************************************** 119 //****************************************************************************** 120 BOOL WIN32API SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION arg1) 121 { 122 return O32_SetTimeZoneInformation(arg1); 123 } 124 //****************************************************************************** 125 //****************************************************************************** 126 BOOL WIN32API SetSystemTime(const SYSTEMTIME * arg1) 127 { 128 return O32_SetSystemTime(arg1); 114 return OSLibDosGetTickCount(); 115 } 116 //****************************************************************************** 117 //The GetLocalTime function retrieves the current local date and time. 118 //(in local time) 119 //****************************************************************************** 120 void WIN32API GetLocalTime(LPSYSTEMTIME lpLocalTime) 121 { 122 if(lpLocalTime == NULL) 123 { 124 SetLastError(ERROR_INVALID_PARAMETER); 125 return; 126 } 127 O32_GetLocalTime(lpLocalTime); 128 } 129 //****************************************************************************** 130 //The SetLocalTime function sets the current local time and date. 131 //(in local time) 132 //****************************************************************************** 133 BOOL WIN32API SetLocalTime(const SYSTEMTIME *lpLocalTime) 134 { 135 if(lpLocalTime == NULL) 136 { 137 SetLastError(ERROR_INVALID_PARAMETER); 138 return FALSE; 139 } 140 return O32_SetLocalTime(lpLocalTime); 141 } 142 //****************************************************************************** 143 //The GetSystemTime function retrieves the current system date and time. 144 //The system time is expressed in Coordinated Universal Time (UTC). 145 //****************************************************************************** 146 void WIN32API GetSystemTime(LPSYSTEMTIME lpSystemTime) 147 { 148 if(lpSystemTime == NULL) 149 { 150 SetLastError(ERROR_INVALID_PARAMETER); 151 return; 152 } 153 O32_GetSystemTime(lpSystemTime); 154 } 155 //****************************************************************************** 156 //The SetSystemTime function sets the current system time and date. 157 //The system time is expressed in Coordinated Universal Time (UCT). 158 //****************************************************************************** 159 BOOL WIN32API SetSystemTime(const SYSTEMTIME *lpSystemTime) 160 { 161 if(lpSystemTime == NULL) 162 { 163 SetLastError(ERROR_INVALID_PARAMETER); 164 return FALSE; 165 } 166 return O32_SetSystemTime(lpSystemTime); 167 } 168 //****************************************************************************** 169 //System time (UTC) to File time (UTC) 170 //****************************************************************************** 171 BOOL WIN32API SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) 172 { 173 return O32_SystemTimeToFileTime(lpSystemTime, lpFileTime); 174 } 175 //****************************************************************************** 176 //****************************************************************************** 177 BOOL WIN32API SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone, 178 LPSYSTEMTIME lpSystemTime, 179 LPSYSTEMTIME lpLocalTime) 180 { 181 return O32_SystemTimeToTzSpecificLocalTime(lpTimeZone, lpSystemTime, lpLocalTime); 182 } 183 //****************************************************************************** 184 //****************************************************************************** 185 DWORD WIN32API GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZone) 186 { 187 return O32_GetTimeZoneInformation(lpTimeZone); 188 } 189 //****************************************************************************** 190 //****************************************************************************** 191 BOOL WIN32API SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION lpTimeZone) 192 { 193 return O32_SetTimeZoneInformation(lpTimeZone); 129 194 } 130 195 /***************************************************************************** 131 196 * Name : DWORD GetSystemTimeAsFileTime 132 197 * Purpose : The GetSystemTimeAsFileTime function obtains the current system 133 * date and time. The information is in Coordinated Universal Time (U TC) format.198 * date and time. The information is in Coordinated Universal Time (UCT) format. 134 199 * Parameters: LLPFILETIME lLPSYSTEMTIMEAsFileTime 135 200 * Variables : … … 143 208 VOID WIN32API GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime) 144 209 { 145 FILETIME ft; /* code sequence from WIN32.HLP */ 146 SYSTEMTIME st; 147 148 dprintf(("KERNEL32: GetSystemTimeAsFileTime(%08xh)\n", lpSystemTimeAsFileTime)); 149 150 GetSystemTime(&st); 151 SystemTimeToFileTime(&st, &ft); 152 } 210 FILETIME ft; /* code sequence from WIN32.HLP */ 211 SYSTEMTIME st; 212 213 GetSystemTime(&st); 214 SystemTimeToFileTime(&st, &ft); 215 } 216 //****************************************************************************** 217 //****************************************************************************** 218
Note:
See TracChangeset
for help on using the changeset viewer.