remove deprecated timeToTimeInfo; fixes #3678
This commit is contained in:
parent
6ae9341d48
commit
116e984a6b
1 changed files with 12 additions and 49 deletions
|
|
@ -1827,43 +1827,6 @@ proc timeToTimeInterval*(t: Time): TimeInterval {.deprecated.} =
|
|||
# Milliseconds not available from Time
|
||||
t.toTimeInterval()
|
||||
|
||||
proc timeToTimeInfo*(t: Time): DateTime {.deprecated.} =
|
||||
## Converts a Time to DateTime.
|
||||
##
|
||||
## **Warning:** This procedure is deprecated since version 0.14.0.
|
||||
## Use ``inZone`` instead.
|
||||
const epochStartYear = 1970
|
||||
|
||||
let
|
||||
secs = t.toSeconds().int
|
||||
daysSinceEpoch = secs div secondsInDay
|
||||
(yearsSinceEpoch, daysRemaining) = countYearsAndDays(daysSinceEpoch)
|
||||
daySeconds = secs mod secondsInDay
|
||||
|
||||
y = yearsSinceEpoch + epochStartYear
|
||||
|
||||
var
|
||||
mon = mJan
|
||||
days = daysRemaining
|
||||
daysInMonth = getDaysInMonth(mon, y)
|
||||
|
||||
# calculate month and day remainder
|
||||
while days > daysInMonth and mon <= mDec:
|
||||
days -= daysInMonth
|
||||
mon.inc
|
||||
daysInMonth = getDaysInMonth(mon, y)
|
||||
|
||||
let
|
||||
yd = daysRemaining
|
||||
m = mon # month is zero indexed enum
|
||||
md = days
|
||||
# NB: month is zero indexed but dayOfWeek expects 1 indexed.
|
||||
wd = getDayOfWeek(days, mon, y).Weekday
|
||||
h = daySeconds div secondsInHour + 1
|
||||
mi = (daySeconds mod secondsInHour) div secondsInMin
|
||||
s = daySeconds mod secondsInMin
|
||||
result = DateTime(year: y, yearday: yd, month: m, monthday: md, weekday: wd, hour: h, minute: mi, second: s)
|
||||
|
||||
proc getDayOfWeek*(day, month, year: int): WeekDay {.tags: [], raises: [], benign, deprecated.} =
|
||||
## **Warning:** This procedure is deprecated since version 0.18.0.
|
||||
getDayOfWeek(day, month.Month, year)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue