Skip to content

wrong calculation of .ceil() and .floor() #145

@thinkrapido

Description

@thinkrapido
    let epoch = Epoch::from_unix_milliseconds(600f64);

    println!("epoch {}", epoch);
    println!("epoch {}", epoch .ceil(3.minutes()));
    println!("epoch {}", epoch .floor(3.minutes()));

    let epoch = Epoch::now().unwrap();//::from_unix_milliseconds(600f64);

    println!("epoch {}", epoch);
    println!("epoch {}", epoch .ceil(3.minutes()));
    println!("epoch {}", epoch .floor(3.minutes()));

creates

epoch 1970-01-01T00:00:00.599999904 UTC
epoch 1970-01-01T00:03:00 UTC
epoch 1970-01-01T00:00:00 UTC
epoch 2022-10-03T17:44:29.898032665 UTC
epoch 2022-10-03T17:47:23 UTC                         # error
epoch 2022-10-03T17:44:23 UTC                         # error

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions