A follow up to Tom Kuffmans comments below.
The problem is that you have to convert local time to GMT to get the correct epoch time for the time zone you are in.
As you suggested I looked at my time zone on my BBWIN client and it reports; "GMT-05:00) Eastern (US & Canada and I have automatically adjust clock for daylight saving changes". I also run Cygwin on my BBWin client and when I enter the command "date" I get "Tue Jun 24 16:42:37 EDT 2008". So I believe my date and timezone are set correctly.
So my next test was to create "file:" test for my BBWin client and a Solaris UNIX client and touch the test files on both clients at the same time so they would have approximately the same mtime.
For the BBWin client the client data returned
[file:c:\Alligate\AAATEST]
type:0x00020 (file)
mode:777 (not implemented)
linkcount:1
owner:0 (not implemented)
group:0 (not implemented)
size:0
atime:1214324279 (2008/06/24-16:17:59)
ctime:1213796626 (2008/06/18-13:43:46)
mtime:1214324279 (2008/06/24-16:17:59)
And for UNIX client the client data returned
[file:/AAATEST]
type:100000 (file)
mode:644 (-rw-r--r--)
linkcount:1
owner:0 (root)
group:1 (other)
size:0
clock:1214338710 (2008/06/24-16:18:30)
atime:1214338680 (2008/06/24-16:18:00)
ctime:1214338680 (2008/06/24-16:18:00)
mtime:1214338680 (2008/06/24-16:18:00)
As you can see the mtime YMD are within a second of each other but the epoch number is off by four hours plus one second.
For BBWin mtime epoch time 1214324279 I get the following returned from http://www.epochconverter.com/.
GMT: Tue, 24 Jun 2008 16:17:59 GM
Your timezone: Tue Jun 24 12:17:59 2008
For UNIX mtime epoch time 1214338680 I get the following retuned http://www.epochconverter.com/
GMT: Tue, 24 Jun 2008 20:18:00 GMT
Your timezone: Tue Jun 24 16:18:00 2008
I believe BBWin is using local time as GMT time and calculating the epoch time which is off by 4 hours which is the different between EDT and GMT.
The code needs to convert local time to GMT and then calculate epoch time.
Robert
-----Original Message----- From: Kauffman, Tom [mailto:KauffmanT at nibco.com] Sent: Tuesday, June 24, 2008 1:36 PM To: hobbit at hswn.dk Subject: [hobbit] RE: BBWin V.12 filesystem epoch time and local time conflict
I think you're looking for something that doesn't exist, unless the windows epoch handling is non-posix. In the Unix/posix environment, the epoch is always UTC and the conversion to local time-zone value occurs as part of the time formatting - there's no such animal as 'local epoch'. I'd look at the system returning these values and make sure the time zone is set correctlyraw, Robert P [mailto:rmcgraw at purdue.edu] Sent: Tuesday, June 24, 2008 11:46 AM To: hobbit at hswn.dk Subject: [hobbit] RE: BBWin V.12 filesystem epoch time and local time conflict
A little more digging and I see
-----Original Message----- From: McGraw, Robert P Sent: Tuesday, June 24, 2008 10:40 AM To: 'hobbit at hswn.dk'; 'bbwin-users at lists.sourceforge.net' Subject: BBWin V.12 filesystem epoch time and local time conflict
I have the [file:] set up in central mode on our BBWin V.12 client and it returns the following client data to the Hobbit server.
[file:c:\Alligate\AAATEST] type:0x00020 (file) mode:777 (not implemented) linkcount:1 owner:0 (not implemented) group:0 (not implemented) size:0 atime:1214222069 (2008/06/23-11:54:29) ctime:1213796626 (2008/06/18-13:43:46) mtime:1214222069 (2008/06/23-11:54:29)On my hobbit server hobbit-clients.cfg I have
FILE c:\Alligate\AAATEST red MTIME<88200The YYYY/MM/DD-HH:MM:SS atime, ctime and mtime are local time.
During testing I noticed that the red icon would come on before I had expected.
I decided to do a little checking and using a web epoch time calculator.
If I enter 2008/06/23-11:54:29 it returns the epoch time of 1214236469, which does not match mtime epoch time above.
If I enter the epoch mtime 1214222069 I get Mon Jun 23 2008 07:54:29 GMT-0400 (EDT) which does not match the date.
If I enter epoch time 1214236469 I get Mon Jun 23 2008 11:54:29 GMT-0400 (EDT)
It seems that the YYYY/MM/DD-HH:MM:SS time is reported in local time and the epoch time is reported in GMT time which throws things off by four hours.
The following is the code in filesystem
325 reportData << format("type:0x%05x ") % handle_file_info.dwFileAttributes; 326 if (handle_file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 327 reportData << "(dir)" << endl; 328 else 329 reportData << "(file)" << endl; 330 reportData << "mode:777 (not implemented)" << endl; 331 reportData << format("linkcount:%u") % handle_file_info.nNumberOfLinks << endl; 332 reportData << "owner:0 (not implemented)" << endl; 333 reportData << "group:0 (not implemented)" << endl; 334 reportData << format("size:%lu") % fsize << endl; 335 string output; 336 GetTimeString(handle_file_info.ftLastAccessTime, output); 337 reportData << "atime:" << output << endl; 338 GetTimeString(handle_file_info.ftCreationTime, output); 339 reportData << "ctime:" << output << endl; 340 GetTimeString(handle_file_info.ftLastWriteTime, output); 341 reportData << "mtime:" << output << endl; 342 fclose(f); 343 return true;
GetTimeString is a function in the filesystem code which follows.
bool AgentFileSystem::GetTimeString(const FILETIME & filetime, string & output) { 255 __int64 ftime = (filetime.dwHighDateTime * MAXDWORD) + filetime.dwLowDateTime; 256 SYSTEMTIME fsystime; 257 FILETIME floctime; 258 time_t epoch; 259 260 if (::FileTimeToLocalFileTime(&filetime, &floctime) == 0) { 261 return false; 262 } 263 if (::FileTimeToSystemTime(&floctime, &fsystime) == 0) { 264 return false; 265 } 266 utils::SystemTimeToTime_t(&fsystime, &epoch); 267 stringstream reportData; 268 reportData << format("%llu (%02d/%02d/%d-%02d:%02d:%02d)") 269 % (unsigned __int64)epoch 270 % fsystime.wYear 271 % fsystime.wMonth 272 % fsystime.wDay 273 % fsystime.wHour 274 % fsystime.wMinute 275 % fsystime.wSecond; 276 output = reportData.str(); 277 return true; 278 }
It seems to me that after line 266 there needs to be a couple lines that converts the GMT epoch to local epoch.
The function GetTimeString seems to be the code that is returning the
time
information. I have not been able to find this code in the BBWin svn so I am not sure if this is a local function or a system function.
I am not a Window type guy and no very little about such things. Can a super duper window type person peruse this and see what they can find.
Tanks
Thanks
Robert
Robert P. McGraw, Jr. Manager, Computer System EMAIL: rmcgraw at purdue.edu Purdue University ROOM: MATH-807 Department of Mathematics PHONE: (765) 494-6055 150 N. University Street West Lafayette, IN 47907-2067
CONFIDENTIALITY NOTICE: This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system. We do not waive attorney-client or work product privilege by the transmission of this message.
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk