Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation notice for Time.now #7586

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,20 @@ struct Time
utc(seconds: seconds, nanoseconds: nanoseconds.to_i)
end

# Creates a new `Time` instance representing the current time from the
# system clock observed in *location* (defaults to local time zone).
@[Deprecated("Use `Time.local` or `Time.utc` instead.")]
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("Use `Time.utc` instead.")]
def self.utc_now : Time
utc
end

# Creates a new `Time` instance with the same local date-time representation
# (wall clock) in a different *location*.
#
Expand Down