Add warnings about deprecation to times module (#7001)

* Add warnings about deprecation to times module

I've added warnings about some procedures being deprecated.
Also I can't find what is the replacement for `getTimezone` proc, please help with that

* Update times.nim

* Update times.nim
This commit is contained in:
Daniil Yarancev 2017-12-30 18:15:15 +03:00 • committed by Dominik Picheta
commit a521f98392

View file

@ -1352,25 +1352,35 @@ else:
proc fromSeconds*(since1970: float): Time {.tags: [], raises: [], benign, deprecated.} = proc fromSeconds*(since1970: float): Time {.tags: [], raises: [], benign, deprecated.} =
## Takes a float which contains the number of seconds since the unix epoch and ## Takes a float which contains the number of seconds since the unix epoch and
## returns a time object. ## returns a time object.
##
## **Deprecated since v0.18.0:** use ``Time`` instead
Time(since1970) Time(since1970)
proc fromSeconds*(since1970: int64): Time {.tags: [], raises: [], benign, deprecated.} = proc fromSeconds*(since1970: int64): Time {.tags: [], raises: [], benign, deprecated.} =
## Takes an int which contains the number of seconds since the unix epoch and ## Takes an int which contains the number of seconds since the unix epoch and
## returns a time object. ## returns a time object.
##
## **Deprecated since v0.18.0:** use ``Time`` instead
Time(since1970) Time(since1970)
proc toSeconds*(time: Time): float {.tags: [], raises: [], benign, deprecated.} = proc toSeconds*(time: Time): float {.tags: [], raises: [], benign, deprecated.} =
## Returns the time in seconds since the unix epoch. ## Returns the time in seconds since the unix epoch.
##
## **Deprecated since v0.18.0:** use ``float`` instead
float(time) float(time)
proc getLocalTime*(time: Time): DateTime {.tags: [], raises: [], benign, deprecated.} = proc getLocalTime*(time: Time): DateTime {.tags: [], raises: [], benign, deprecated.} =
## Converts the calendar time `time` to broken-time representation, ## Converts the calendar time `time` to broken-time representation,
## expressed relative to the user's specified time zone. ## expressed relative to the user's specified time zone.
##
## **Deprecated since v0.18.0:** use ``local`` instead
time.local time.local
proc getGMTime*(time: Time): DateTime {.tags: [], raises: [], benign, deprecated.} = proc getGMTime*(time: Time): DateTime {.tags: [], raises: [], benign, deprecated.} =
## Converts the calendar time `time` to broken-down time representation, ## Converts the calendar time `time` to broken-down time representation,
## expressed in Coordinated Universal Time (UTC). ## expressed in Coordinated Universal Time (UTC).
##
## **Deprecated since v0.18.0:** use ``utc`` instead
time.utc time.utc
proc getTimezone*(): int {.tags: [TimeEffect], raises: [], benign, deprecated.} = proc getTimezone*(): int {.tags: [TimeEffect], raises: [], benign, deprecated.} =