change to use localtime

using gmtime in python doesn't take into account DST. By syncing localtime using NTP and then exchange this in the code, the time should always be the same.