Skip to content

rounding to tenth of a second doesn't work #502

Description

@archenemies

I would expect floor_date(...,"0.1 seconds") to either floor my date to the nearest tenth of a second, or throw an error. It does neither:

> t=Sys.time()
> x=as.numeric(t); x-floor(x)
[1] 0.8007953
> x=as.numeric(floor_date(t,"0.1 seconds")); x-floor(x)
[1] 0

The problem seems to be in parse_period_unit:

> lubridate:::parse_period_unit("5 seconds")
$n
[1] 5

$unit
[1] "second"

> lubridate:::parse_period_unit("0.1 seconds")
$n
[1] 1

$unit
[1] "second"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions