@@ -1759,8 +1759,8 @@ function _G.generateFromTemplateString(page, template, modTime, onPageInit)
17591759 page._readonly = true
17601760
17611761 if
1762- (page.isDraft.v and not includeDrafts ) or -- Is draft?
1763- (datetimeToTime(page.publishDate:g()) > os.time() ) -- Is in future?
1762+ (page.isDraft.v and not includeDrafts ) or -- Is draft?
1763+ (datetimeToTime(page.publishDate:g()) > nowTime ) -- Is in future?
17641764 then
17651765 page._isSkipped = true
17661766 site._outputFileSkippedPageCount = site._outputFileSkippedPageCount + 1
@@ -1986,7 +1986,7 @@ end
19861986function _G.getDatetime(time)
19871987 !ARGS "? time:number"
19881988
1989- local date = dateLib(time or os.time() ):tolocal()
1989+ local date = dateLib(time or nowTime ):tolocal()
19901990 local datetime = date:fmt"${iso}%z" :gsub("..$", ":%0") :gsub("%+00:00$", "Z")
19911991
19921992 return datetime
@@ -2619,8 +2619,7 @@ end
26192619-- Compute the difference in seconds between local time and UTC. (Normal time.)
26202620-- http://lua-users.org/wiki/TimeZone
26212621function _G.getTimezone()
2622- local now = os.time()
2623- return os.difftime(now, os.time(os.date("!*t", now)))
2622+ return os.difftime(nowTime, os.time(os.date("!*t", nowTime)))
26242623end
26252624
26262625-- Return a timezone string in ISO 8601:2000 standard form (+hhmm or -hhmm).
@@ -2632,7 +2631,7 @@ end
26322631-- Return the timezone offset in seconds, as it was on the given time. (DST obeyed.)
26332632-- timezoneOffset = getTimezoneOffset( [ time=now ] )
26342633function _G.getTimezoneOffset(time)
2635- time = time or os.time()
2634+ time = time or nowTime
26362635 local dateUtc = os.date("!*t", time)
26372636 local dateLocal = os.date("*t", time)
26382637 dateLocal.isdst = false -- This is the trick.
0 commit comments