04.09.2006, 18:26
|
#17
|
Участник
Регистрация: 28.11.2005
Адрес: Москва
|
Цитата:
Сообщение от Gustav
Надо только найти еще один час. Есть ли какие-нибудь соображения насчет этого дополнительного часа?
Пойдем от обратного. Зачем нам заморачиваться с часовыми поясами, если и система считает время по Гринвичу, и файловые времена хранятся по Гринвичу?
X++: // дополнение к классу WinAPI
client server static Binary getSystemTime()
{
DLL _winApiDLL = new DLL(#KernelDLL);
DLLFunction _getSystemTime = new DLLFunction(_winApiDLL, @'GetSystemTime');
Binary systemTime = new Binary(#offset16);
_getSystemTime.returns(ExtTypes::void);
_getSystemTime.arg(ExtTypes::Pointer);
_getSystemTime.call(systemTime);
return systemTime;
}
static void KKu_Job_6901_TestFileTime(Args _args)
{
FileName fileName = @'c:\testtime.txt';
int hFile;
;
if (WinAPI::fileExists( fileName ))
WinAPI::deleteFile( fileName );
hFile = WinAPI::createFile( fileName );
WinAPI::closeHandle( hFile );
info( fileName );
info( 'Даты/вреям в формате ГГ ММ ДД / ЧЧ ММ СС' );
info( strfmt("created date/time %1/%2", date2str(WinAPI::getFileCreatedDate(fileName), 321,2,1,2,1,2), time2str(WinAPI::getFileCreatedTime(fileName), 3,1)));
info( strfmt("modified date/time %1/%2", date2str(WinAPI::getFileModifiedDate(fileName),321,2,1,2,1,2), time2str(WinAPI::getFileModifiedTime(fileName),3,1)));
info( strfmt("accessed date/time %1/%2", date2str(WinAPI::getFileAccessedDate(fileName),321,2,1,2,1,2), time2str(WinAPI::getFileAccessedTime(fileName),3,1)));
info( 'Время "сейчас" в формате ЧЧ ММ СС' );
info( time2str( WinAPI::systemTimeToTimeOfDay(WinAPI::getSystemTime()),3,1) );
} На выходе получаем:Код: c:\testtime.txt
Даты/вреям в формате ГГ ММ ДД / ЧЧ ММ СС
created date/time 06 09 04/14 29 12
modified date/time 06 09 04/14 29 12
accessed date/time 06 09 04/14 29 12
Время "сейчас" в формате ЧЧ ММ СС
14 29 12 При том что текущее время у меня на компе - 18:29 (UTC +03:00 +1 час за счет летнего времени).
|
|