改进ToDateTime在输入时间为0时的处理
This commit is contained in:
parent
6aec9ccacf
commit
c7f4421c61
@ -80,10 +80,10 @@ namespace hgl
|
|||||||
|
|
||||||
SystemTimeToTzSpecificLocalTime(&time_zone, &st, &local_time);
|
SystemTimeToTzSpecificLocalTime(&time_zone, &st, &local_time);
|
||||||
|
|
||||||
hours = local_time.wHour;
|
hours = local_time.wHour;
|
||||||
minutes = local_time.wMinute;
|
minutes = local_time.wMinute;
|
||||||
seconds = local_time.wSecond;
|
seconds = local_time.wSecond;
|
||||||
micro_seconds = local_time.wMilliseconds * 1000;
|
micro_seconds = local_time.wMilliseconds * 1000;
|
||||||
week_day = local_time.wDayOfWeek;
|
week_day = local_time.wDayOfWeek;
|
||||||
|
|
||||||
SystemTimeToMicroTime(<64, &local_time);
|
SystemTimeToMicroTime(<64, &local_time);
|
||||||
@ -118,9 +118,17 @@ namespace hgl
|
|||||||
FILETIME ft,local_ft;
|
FILETIME ft,local_ft;
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
|
|
||||||
MicroTimeToFileTime(&ft, cur_time*HGL_MICRO_SEC_PER_SEC);
|
if(cur_time<=0)
|
||||||
|
{
|
||||||
|
GetLocalTime(&st);
|
||||||
|
SystemTimeToFileTime(&st,&ft);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MicroTimeToFileTime(&ft, cur_time*HGL_MICRO_SEC_PER_SEC);
|
||||||
|
FileTimeToSystemTime(&ft, &st);
|
||||||
|
}
|
||||||
|
|
||||||
FileTimeToSystemTime(&ft, &st);
|
|
||||||
FileTimeToLocalFileTime(&ft, &local_ft);
|
FileTimeToLocalFileTime(&ft, &local_ft);
|
||||||
|
|
||||||
d.Set(st.wYear, st.wMonth, st.wDay, st.wDayOfWeek);
|
d.Set(st.wYear, st.wMonth, st.wDay, st.wDayOfWeek);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user