Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensystime.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS system libraries 00004 * FILE: lib/crt/?????? 00005 * PURPOSE: Unknown 00006 * PROGRAMER: Unknown 00007 * UPDATE HISTORY: 00008 * 25/11/05: Added license header 00009 */ 00010 00011 #include <precomp.h> 00012 00013 int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31}; 00014 00015 /* 00016 * @unimplemented 00017 */ 00018 unsigned int _getsystime(struct tm* tp) 00019 { 00020 SYSTEMTIME Time; 00021 int i; 00022 DWORD TimeZoneId; 00023 TIME_ZONE_INFORMATION TimeZoneInformation; 00024 00025 GetLocalTime(&Time); 00026 00027 tp->tm_year = Time.wYear - 1900; 00028 tp->tm_mon = Time.wMonth - 1; 00029 tp->tm_wday = Time.wDayOfWeek; 00030 tp->tm_mday = Time.wDay; 00031 tp->tm_hour = Time.wHour; 00032 tp->tm_min = Time.wMinute; 00033 tp->tm_sec = Time.wSecond; 00034 00035 tp->tm_isdst = -1; 00036 00037 TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation); 00038 if (TimeZoneId == TIME_ZONE_ID_DAYLIGHT){ 00039 tp->tm_isdst = 1; 00040 } 00041 else 00042 tp->tm_isdst = 0; 00043 00044 if (tp->tm_year % 4 == 0) { 00045 if (tp->tm_year % 100 != 0) 00046 tp->tm_yday = 1; 00047 else if ((tp->tm_year-100) % 1000 == 0) 00048 tp->tm_yday = 1; 00049 } 00050 00051 for (i = 0; i <= tp->tm_mon; i++) 00052 tp->tm_yday += month[i]; 00053 00054 return Time.wMilliseconds; 00055 } 00056 00057 00058 /* 00059 * @implemented 00060 */ 00061 unsigned int _setsystime(struct tm* tp, unsigned int ms) 00062 { 00063 SYSTEMTIME Time; 00064 00065 Time.wYear = tp->tm_year + 1900; 00066 Time.wMonth = tp->tm_mon + 1; 00067 Time.wDayOfWeek = tp->tm_wday; 00068 Time.wDay = tp->tm_mday; 00069 Time.wHour = tp->tm_hour; 00070 Time.wMinute = tp->tm_min; 00071 Time.wSecond = tp->tm_sec; 00072 Time.wMilliseconds = ms; 00073 00074 if (!SetLocalTime(&Time)) 00075 return -1; 00076 00077 return 0; 00078 } Generated on Fri May 25 2012 04:35:10 for ReactOS by
1.7.6.1
|