Skip to content

Commit

Permalink
Make Time.now an alias
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Mar 26, 2019
1 parent 5b9c4cc commit 7808761
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,22 @@ struct Time
utc(seconds: seconds, nanoseconds: nanoseconds.to_i)
end

def self.now(*args)
{% raise "`Time.now` has been removed in Crystal 0.28.0, use `Time.local` or `Time.utc` instead.\n\nMore information on this change: https://github.com/crystal-lang/crystal/issues/5346" %}
# Creates a new `Time` instance representing the current time from the
# system clock observed in *location* (defaults to local time zone).
#
# DEPRECATED: `Time.now` is deprecated, use `Time.local` or `Time.utc` instead.
# More information on this change: https://github.com/crystal-lang/crystal/issues/5346
def self.now(location : Location = Location.local) : Time
local(location)
end

# Creates a new `Time` instance representing the current time from the
# system clock in UTC.
#
# DEPRECATED: `Time.utc_now` is deprecated, use `Time.utc` instead.
# More information on this change: https://github.com/crystal-lang/crystal/issues/5346
def self.utc_now : Time
utc
end

# Creates a new `Time` instance with the same local date-time representation
Expand Down

0 comments on commit 7808761

Please sign in to comment.