Skip to content


Smarty, WinSCP and Timezone issues

01 Apr 2009

So, daylight savings time started a few days ago, and suddenly some problems that I had with Smarty last summer are back. Last time I was relatively new to Smarty, so I blamed Smarty itself... This time I know better.

The problem

When I modify a template, the old (compiled) version was being displayed, instead of it being recompiled automatically. (I resorted to deleting the contents of the templates_c/ directory each time!)

The culprit

Today I noticed that the timestamp of the compiled files in templates_c/ was an hour in the future in WinSCP. But when I checked using SSH, they were correct on the server, and the template files were an hour behind.

It turns out WinSCP was incorrectly adding an extra hour to all timestamps. But this wasn't just affecting what it displays - whenever it uploaded a file, it would subtract an hour from the timestamp to compensate. So Smarty would not know the template had been updated, and so would not recompile it.

The solution

Edit the saved session, and in the Environment section is a Daylight saving time box. Change it from "Adjust remote timestamp to local conventions (Unix)" to "Preserve remote timestamp (Unix)". Save the session and reconnect.

n.b. An alternate is to go to View > Preferences > Transfer and uncheck "Preserve timestamp". (Although it'll still show incorrect times in the file list.)

Current Mood:Cheerful
Listening To:Robbie Williams - She's Madonna
Random Fact:Switched from Subversion to Bazaar and liking it much better. Git was also considered, but not user-friendly enough.

Add a Comment

* Required field