And it is!
Function epochTime assumes a local time and converts to UTC:
function epochTime([System.DateTime] $t) { [uint32](($t.Ticks - ([DateTime] "1/1/1970 00:00:00").Ticks) / 10000000) - $osinfo.CurrentTimeZone*60
}
But it's being used on times that are already UTC
function XymonFileStat($file,$hash="") { ... "atime:{0} ({1})" -f (epochTime $fh.LastAccessTimeUtc),$fh.LastAccessTime.ToString("yyyy/MM/dd-HH:mm:ss") "ctime:{0} ({1})" -f (epochTime $fh.CreationTimeUtc),$fh.CreationTime.ToString("yyyy/MM/dd-HH:mm:ss") "mtime:{0} ({1})" -f (epochTime $fh.LastWriteTimeUtc),$fh.LastWriteTime.ToString("yyyy/MM/dd-HH:mm:ss") ... }
I think the fix is to change the lines above to
"atime:{0} ({1})" -f (epochTime $fh.LastAccessTime),$fh.LastAccessTime.ToString("yyyy/MM/dd-HH:mm:ss")
"ctime:{0} ({1})" -f (epochTime $fh.CreationTime),$fh.CreationTime.ToString("yyyy/MM/dd-HH:mm:ss")
"mtime:{0} ({1})" -f (epochTime $fh.LastWriteTime),$fh.LastWriteTime.ToString("yyyy/MM/dd-HH:mm:ss")
glauber -----Original Message----- From: Ribeiro, Glauber Sent: Tuesday, January 07, 2014 16:09 To: 'xymon at xymon.com' Subject: RE: Is the powershell windows client reporting file time incorrectly?
It looks as if in the new client, the GMT correction is being applied twice, or GMT correction is being applied to a time that's already in GMT.
g
-----Original Message----- From: Ribeiro, Glauber Sent: Tuesday, January 07, 2014 16:02 To: 'xymon at xymon.com' Subject: Is the powershell windows client reporting file time incorrectly?
Please see this: http://lists.xymon.com/oldarchive/2008/06/msg00441.html
And here is what the new client reports for a file in my system:
[file:D:\tsiback\today\tsbackup.log] type:100000 (file) mode:777 (not implemented) linkcount:1 owner:0 (BUILTIN\Administrators) group:0 (MCKOEMTAB3\None) size:7764 atime:1389100219 (2014/01/07-01:10:18) ctime:1389100219 (2014/01/07-01:10:18) mtime:1389100676 (2014/01/07-01:17:56) FileVersion: FileDescription:
Let's take mtime. 2014/01/07-01:17:56 is correct, in local time. 1389100676, if I'm not mistaken (big if) is 2014-01-07 13:17:56
I'm at GMT-6 (USA Central Time), so the correct time stamp for the file in GMT would have been 07:17, not 13:17. Xymon sees the time "in the future" and reports that the file is massively out of synch ("File was modified 4294959253 seconds ago - should be <108000").
==================================
Compare with the old BBWin client (same file name, but different server):
[file:d:/tsiback/today/tsbackup.log] type:0x00020 (file) mode:777 (not implemented) linkcount:1 owner:0 (not implemented) group:0 (not implemented) size:4823 atime:1389062375 (2014/01/7-02:39:35) ctime:1389058500 (2014/01/7-01:35:00) mtime:1389062373 (2014/01/7-02:39:33)
1389062373 is 2014-01-07 02:39:33, so the old client is reporting the unixepoch in local time, as described in the old bug report I mentioned at the start of this email.
Also, why is the "type" reported differently? (100000 versus 0x0020) Does it matter?
glauber