optimize datetime::now() to avoid two calls of localtime()