Good catch, runrig. I only tested my code snippet locally and it didn't occur to me that I was using localtime() locally, even though the file stat info would be from another host. I'm too used to relying on my ssh configs and the command line to do things like that:
$ ssh somedomain.com somecommand
Running stat on the remote host would give me the remote localtime. But that's not what the OP is doing.