Skip to content

can hms handle milliseconds? #33

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

Closed
randomgambit opened this issue Apr 26, 2017 · 7 comments
Closed

can hms handle milliseconds? #33

randomgambit opened this issue Apr 26, 2017 · 7 comments

Comments

@randomgambit
Copy link

I am using hms to parse the time (hour, minutes, seconds, milliseconds) from timestamps in my data.
Unfortunately, I notice that hms seems to forget about the millisecond part of a time (in character format).

> as.hms("12:34:56")
12:34:56
> as.hms("12:34:56.542")
12:34:56
> options(digits.secs=3)
> as.hms("12:34:56.542")
12:34:56

Is that a bug? Having milliseconds is important because I sort the data according to time...

@randomgambit randomgambit changed the title can hms handle miliseconds? can hms handle milliseconds? Apr 26, 2017
@krlmlr krlmlr closed this as completed in 70a2eaf Apr 26, 2017
@krlmlr
Copy link
Member

krlmlr commented Apr 26, 2017

Thanks for reporting!

krlmlr added a commit that referenced this issue Apr 26, 2017
- `as.hms.character()` and `parse_hms()` accept fractional seconds (#33).
@krlmlr
Copy link
Member

krlmlr commented Apr 26, 2017

Fixed in the development version.

@randomgambit
Copy link
Author

you re welcome!. I am an hardcore user of intraday timestamps, so im happy to report any bugs.
When are the updates expected to be on CRAN? I cannot use devtools at work (need to install from zip)

@krlmlr
Copy link
Member

krlmlr commented Apr 26, 2017

No ETA yet. Can you build a .tar.gz at home using R CMD build?

@randomgambit
Copy link
Author

never done so. how can I do that?

@krlmlr
Copy link
Member

krlmlr commented Apr 27, 2017

Download or clone the repository from GitHub, extract, and run R CMD build . from the terminal.

krlmlr added a commit that referenced this issue Nov 23, 2017
Breaking changes
----------------

- `as.hms.POSIXt()` now defaults to the current time zone, the previous default was `"UTC"` and can be restored by calling `pkgconfig::set_config("hms::default_tz", "UTC")`.

New features
------------

- Pillar support, will display `hms` columns in tibbles in color on terminals
  that support it (#43).
- New `round_hms()` and `trunc_hms()` for rounding or truncating to a given multiple of seconds (#31).
- New `parse_hms()` and `parse_hm()` to parse strings in "HH:MM:SS" and "HH:MM" formats (#30).
- `as.hms.POSIXt()` gains `tz` argument, default `"UTC"` (#28).
- `as.hms.character()` and `parse_hms()` accept fractional seconds (#33).

Bug fixes
---------

- `hms()` now works correctly if all four components (days, hours, minutes, seconds) are passed (#49).
- `hms()` creates a zero-length object of class `hms` that prints as `"hms()"`.
- `hms(integer())` and `as.hms(integer())` both work and are identical to `hms()`.
- Values with durations of over 10000 hours are now printed correctly (#48).
- `c()` now returns a hms (#41, @qgeissmann).

Documentation and error messages
--------------------------------

- Fix and enhance examples in `?hms`.
- Documentation is in Markdown format now.
- Improved error message if calling `hms()` with a character argument (#29).
@github-actions
Copy link
Contributor

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants