tests/testthat/test-timestamp.R

test_that("fractional seconds can be roundtripped", {
  skip_if_not(TEST_RE2)

  con <- dbConnect(duckdb())
  on.exit(dbDisconnect(con, shutdown = TRUE))

  df <- data.frame(a = as.POSIXct(
    1.234567 + (1:100) * 1e-6,
    origin = structure(0, class = c("POSIXct", "POSIXt")),
    tz = "UTC"
  ))
  dbWriteTable(con, "df", df)
  df_out <- dbReadTable(con, "df")
  expect_equal(df_out, df)
})

Try the duckdb package in your browser

Any scripts or data that you put into this service are public.

duckdb documentation built on Oct. 30, 2024, 5:06 p.m.