Вниз
Скачать: CL | DM;

Надо уменьшать системное время ?   Найти похожие ветки 

← →
Дмитрий Д. ©   (2002-07-24 07:49) [0]

подскажите где я не прав ?

var
NewTime: SYSTEMTIME;
Year, Month,Day, Hour, Min, Sec, MSec: Word;
begin
DecodeTime(now, Hour, Min, Sec, MSec);
DecodeDate(now, Year, Month, Day);
NewTime.wYear := Year;
NewTime.wMonth := Month;
NewTime.wDayOfWeek:=DayOfWeek(now);
NewTime.wDay := Day;
NewTime.wHour := Hour;
NewTime.wMinute := Min-1;
NewTime.wSecond := 0;
NewTime.wMilliseconds := 0;
setsystemtime(NewTime);

и будет ли работать такой код под ХР ?


← →
han_malign   (2002-07-24 10:51) [1]

2002/10/23:15.00.00.00
==>
2002/10/23:15. -1.00.00 ??? (word(-1)=$FFFF)

P.S. DateTimeToSystemTime(now-1/(24*60),NewTime)- без всяких коллизий (даже в Новый Год - на високосный), все остальное Win32 API и должно работать (разве что с правами админа какая бяка).

P.P.S.
Remarks

Windows NT: The SetSystemTime function fails if the calling process does not have the SE_SYSTEMTIME_NAME privilege. This privilege is disabled by default. Use the AdjustTokenPrivileges function to enable this privilege and again to disable it after the time has been set. For more information about security privileges, see Privileges.
Windows 95: Security privileges are not supported or required.

P.P.P.S
now - дает локальное время, а SetSystemTime устанавливает UTC,
так что пользовать нужно SetLocalTime



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.011 c
14-8160
Юра
2002-09-09 18:50
2002.10.03
DBGrid без мыши?


1-8054
dim-
2002-09-22 13:20
2002.10.03
компоненты


3-7839
Alex-kosmonavt
2002-09-12 16:47
2002.10.03
TQuery


14-8133
NetBreaker666
2002-09-08 22:50
2002.10.03
Now I have Internet


14-8178
Con
2002-09-07 08:18
2002.10.03
TQuery




   Наверх