Skip to content

Rename ctime to asctime and add *proper* ctime. #15369

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

Merged
merged 1 commit into from
Jul 4, 2014
Merged

Rename ctime to asctime and add *proper* ctime. #15369

merged 1 commit into from
Jul 4, 2014

Conversation

omasanori
Copy link
Contributor

In C, ctime(t) is equivalent to asctime(localtime(t)), so the result should depend on the local timezone. Current ctime is compatible with asctime in C, not ctime.

This commit renames ctime to asctime and adds ctime which converts the time to the local timezone before formatting it.

This commit also fixes the documentation of them. Current documentation of ctime says it returns "a string of the current time." However, it actually returns a string of the time represented as self, not the time when it is called.

In C, `ctime(t)` is equivalent to `asctime(localtime(t))`, so the result
should depend on the local timezone. Current `ctime` is compatible with
`asctime` in C, not `ctime`.

This commit renames `ctime` to `asctime` and adds `ctime` which converts
the time to the local timezone before formatting it.

This commit also fixes the documentation of them. Current documentation
of `ctime` says it returns "a string of the current time." However, it
actually returns a string of the time represented as `self`, not the
time when it is called.

Signed-off-by: OGINO Masanori <[email protected]>
bors added a commit that referenced this pull request Jul 4, 2014
In C, `ctime(t)` is equivalent to `asctime(localtime(t))`, so the result should depend on the local timezone. Current `ctime` is compatible with `asctime` in C, not `ctime`.

This commit renames `ctime` to `asctime` and adds `ctime` which converts the time to the local timezone before formatting it.

This commit also fixes the documentation of them. Current documentation of `ctime` says it returns "a string of the current time." However, it actually returns a string of the time represented as `self`, not the time when it is called.
@bors bors closed this Jul 4, 2014
@bors bors merged commit 4530f8b into rust-lang:master Jul 4, 2014
@omasanori omasanori deleted the asctime branch July 4, 2014 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants