Fix local/gmtime bug, use user provided struct