|
188 | 188 | @test round(x, Dates.Microsecond) == Dates.Microsecond(2001000) |
189 | 189 | @test round(x, Dates.Nanosecond) == x |
190 | 190 | end |
191 | | - |
| 191 | +@testset "Rounding Time" begin |
| 192 | + x = Time(9, 25, 45, 25, 650, 500) |
| 193 | + @test floor(x, Dates.Hour) == Time(9) |
| 194 | + @test floor(x, Dates.Minute) == Time(9, 25) |
| 195 | + @test floor(x, Dates.Second) == Time(9, 25, 45) |
| 196 | + @test floor(x, Dates.Millisecond) == Time(9, 25, 45, 25) |
| 197 | + @test floor(x, Dates.Microsecond) == Time(9, 25, 45, 25, 650) |
| 198 | + @test floor(x, Dates.Nanosecond) == x |
| 199 | + @test ceil(x, Dates.Hour) == Time(10) |
| 200 | + @test ceil(x, Dates.Minute) == Time(9, 26) |
| 201 | + @test ceil(x, Dates.Second) == Time(9, 25, 46) |
| 202 | + @test ceil(x, Dates.Millisecond) == Time(9, 25, 45, 26) |
| 203 | + @test ceil(x, Dates.Microsecond) == Time(9, 25, 45, 25, 651) |
| 204 | + @test ceil(x, Dates.Nanosecond) == x |
| 205 | + @test round(x, Dates.Hour) == Time(9) |
| 206 | + @test round(x, Dates.Minute) == Time(9, 26) |
| 207 | + @test round(x, Dates.Second) == Time(9, 25, 45) |
| 208 | + @test round(x, Dates.Millisecond) == Time(9, 25, 45, 26) |
| 209 | + @test round(x, Dates.Microsecond) == Time(9, 25, 45, 25, 651) |
| 210 | + @test round(x, Dates.Nanosecond) == x |
| 211 | +end |
192 | 212 | @testset "Rounding DateTime to Date" begin |
193 | 213 | now_ = DateTime(2020, 9, 1, 13) |
194 | 214 | for p in (Year, Month, Day) |
|
0 commit comments