Skip to content

Commit

Permalink
remove deprecated function calls #20
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Jul 4, 2024
1 parent b48baea commit 24914d4
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 70 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: timeless
Title: Fast General Purpose Date/Time Converter
Version: 0.2.2.9000
Version: 0.2.3
Authors@R:
c(person("David", "Schoch", , "david@schochastics.net", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2952-4812")),
Expand All @@ -16,11 +16,12 @@ BugReports: https://github.com/schochastics/timeless/issues
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.0
Config/rextendr/version: 0.3.1
RoxygenNote: 7.3.1
Config/rextendr/version: 0.3.1.9000
Depends:
R (>= 3.6)
LazyData: true
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
SystemRequirements: Cargo (Rust's package manager), rustc
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# timeless 0.2.2.9000
# timeless 0.2.3

* proper Makefile and pkg vendoring #19
* fix deprecated warnings #20

# timeless 0.2.2

Expand Down
2 changes: 1 addition & 1 deletion R/extendr-wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#' @usage NULL
#' @useDynLib timeless, .registration = TRUE
"_PACKAGE"
NULL

parse_guess_rs <- function(times) .Call(wrap__parse_guess_rs, times)

Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,40 +113,40 @@ chronos(bench_date, out_format = "datetime")
#> [21] "2017-11-25 21:31:00 CET" "2014-12-16 06:20:00 CET"
#> [23] "2014-12-16 06:20:00 CET" "2014-04-26 05:13:43 CEST"
#> [25] "2014-04-26 04:13:44 CEST" "2012-08-03 18:31:59 CEST"
#> [27] "2015-09-30 18:48:56 CEST" "2021-02-21 05:24:46 CET"
#> [29] "2021-02-22 05:24:46 CET" "2021-02-21 05:24:46 CET"
#> [31] "2020-07-20 05:24:46 CEST" "2024-03-29 00:06:06 CET"
#> [33] "2024-03-29 15:00:00 CET" "2024-03-29 05:00:00 CET"
#> [35] "2024-03-28 09:06:06 CET" "2024-03-29 00:00:00 CET"
#> [37] "2024-03-28 14:00:00 CET" "2024-03-29 18:00:00 CET"
#> [27] "2015-09-30 18:48:56 CEST" "2021-02-21 08:09:09 CET"
#> [29] "2021-02-22 07:09:09 CET" "2021-02-21 07:09:09 CET"
#> [31] "2020-07-20 07:09:09 CEST" "2024-07-03 23:06:06 CEST"
#> [33] "2024-07-04 14:00:00 CEST" "2024-07-04 04:00:00 CEST"
#> [35] "2024-07-03 09:06:06 CEST" "2024-07-04 00:00:00 CEST"
#> [37] "2024-07-03 14:00:00 CEST" "2024-07-04 18:00:00 CEST"
#> [39] "2024-05-06 19:24:00 CEST" "2024-05-27 00:45:27 CEST"
#> [41] "2009-05-08 15:57:51 CEST" "2012-09-17 08:09:00 CEST"
#> [43] "2012-09-17 08:10:09 CEST" "2021-05-02 15:51:31 CEST"
#> [45] "2021-05-02 15:51:00 CEST" "2021-05-26 07:49:00 CEST"
#> [47] "2012-09-17 18:09:00 CEST" "2021-02-21 05:24:46 CET"
#> [49] "2021-05-25 04:24:46 CEST" "1970-10-07 05:24:46 CET"
#> [51] "1970-10-07 05:24:46 CET" "1970-10-07 05:24:46 CET"
#> [53] "1970-10-07 05:24:46 CET" "1970-10-07 05:24:46 CET"
#> [47] "2012-09-17 18:09:00 CEST" "2021-02-21 08:09:09 CET"
#> [49] "2021-05-25 07:09:09 CEST" "1970-10-07 08:09:09 CET"
#> [51] "1970-10-07 08:09:09 CET" "1970-10-07 08:09:09 CET"
#> [53] "1970-10-07 08:09:09 CET" "1970-10-07 08:09:09 CET"
#> [55] "2006-02-12 18:17:00 CET" "2006-02-12 18:17:00 CET"
#> [57] "2019-05-14 17:11:40 CEST" "1970-10-07 05:24:46 CET"
#> [59] "1970-10-07 05:24:46 CET" "2013-02-03 05:24:46 CET"
#> [61] "2013-07-01 04:24:46 CEST" "2014-04-08 20:05:00 CEST"
#> [57] "2019-05-14 17:11:40 CEST" "1970-10-07 08:09:09 CET"
#> [59] "1970-10-07 08:09:09 CET" "2013-02-03 08:09:09 CET"
#> [61] "2013-07-01 07:09:09 CEST" "2014-04-08 20:05:00 CEST"
#> [63] "2014-04-08 20:05:00 CEST" "2014-04-08 20:05:00 CEST"
#> [65] "2014-02-04 03:00:51 CET" "1965-08-07 23:00:00 CET"
#> [67] "1965-08-08 12:00:01 CET" "1965-08-08 13:00:00 CET"
#> [69] "1965-08-08 13:00:00 CET" "1965-08-08 00:00:00 CET"
#> [71] "2014-02-04 03:00:51 CET" "2012-03-19 10:11:59 CET"
#> [73] "2012-03-19 09:11:59 CET" "2014-03-31 04:24:46 CEST"
#> [75] "2014-03-31 04:24:46 CEST" "1971-08-21 05:24:46 CET"
#> [77] "1971-08-01 05:24:46 CET" "2014-04-08 20:05:00 CEST"
#> [73] "2012-03-19 09:11:59 CET" "2014-03-31 07:09:09 CEST"
#> [75] "2014-03-31 07:09:09 CEST" "1971-08-21 08:09:09 CET"
#> [77] "1971-08-01 08:09:09 CET" "2014-04-08 20:05:00 CEST"
#> [79] "2014-04-08 20:05:00 CEST" "2014-04-02 03:00:51 CEST"
#> [81] "2014-04-02 03:00:51 CEST" "2012-03-19 10:11:59 CET"
#> [83] "2012-03-19 09:11:59 CET" "2014-03-31 04:24:46 CEST"
#> [85] "2014-03-31 04:24:46 CEST" "2014-03-31 04:24:46 CEST"
#> [87] "2014-03-31 04:24:46 CEST" "1971-08-21 05:24:46 CET"
#> [89] "2014-03-30 04:24:46 CEST" "2014-03-29 05:24:46 CET"
#> [83] "2012-03-19 09:11:59 CET" "2014-03-31 07:09:09 CEST"
#> [85] "2014-03-31 07:09:09 CEST" "2014-03-31 07:09:09 CEST"
#> [87] "2014-03-31 07:09:09 CEST" "1971-08-21 08:09:09 CET"
#> [89] "2014-03-30 07:09:09 CEST" "2014-03-04 08:09:09 CET"
#> [91] "2017-11-13 13:14:20 CET" "2014-04-08 09:25:18 CEST"
#> [93] "2014-04-08 04:24:46 CEST"
#> [93] "2014-04-08 07:09:09 CEST"
```

## Functions
Expand Down Expand Up @@ -239,11 +239,11 @@ microbenchmark::microbenchmark(
)
#> Unit: microseconds
#> expr min lq mean median uq
#> chronos(bench_date) 896.271 980.694 1182.24 1106.29 1285.36
#> anytime::anytime(bench_date) 30462.110 34285.474 38231.60 36191.40 41504.53
#> chronos(bench_date) 898.682 990.799 1161.85 1106.01 1217.82
#> anytime::anytime(bench_date) 30551.881 32954.088 37309.36 35526.34 38581.95
#> max neval
#> 2147.17 100
#> 54899.96 100
#> 2890.17 100
#> 67170.21 100
```

See [this
Expand Down
4 changes: 2 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Update from 0.2.1 to 0.2.2
## Update from 0.2.2 to 0.2.3

* hotfix CRAN errors
* fix CRAN errors on r devel linux

## R CMD check results

Expand Down
35 changes: 0 additions & 35 deletions man/timeless-package.Rd

This file was deleted.

6 changes: 3 additions & 3 deletions src/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn parse_date_rs(times: Vec<String>, formats: Vec<String>, out_format: &str) ->
.map(|time_str| {
for fmt in &formats {
if let Ok(date) = NaiveDate::parse_from_str(time_str, fmt) {
let naive_datetime = date.and_hms(0, 0, 0);
let naive_datetime = date.and_hms_milli_opt(0, 0, 0, 0).unwrap();
return naive_datetime.format(out_format).to_string();
}
}
Expand All @@ -54,7 +54,7 @@ fn parse_epoch_rs(times: Vec<String>, out_format: &str) -> Vec<String> {
.iter()
.map(|time_str| {
if let Ok(epoch_seconds) = time_str.parse::<i64>() {
let naive_date_time = NaiveDateTime::from_timestamp(epoch_seconds, 0);
let naive_date_time = NaiveDateTime::from_timestamp_opt(epoch_seconds, 0).unwrap();
return naive_date_time.format(out_format).to_string();
}
"not found".to_string()
Expand All @@ -67,7 +67,7 @@ fn parse_epoch_i64_rs(times: Vec<i32>, out_format: &str) -> Vec<String> {
times
.iter()
.map(|&epoch| {
let naive_date_time = NaiveDateTime::from_timestamp(epoch.into(), 0);
let naive_date_time = NaiveDateTime::from_timestamp_opt(epoch.into(), 0).unwrap();
naive_date_time.format(out_format).to_string()
})
.collect()
Expand Down

0 comments on commit 24914d4

Please sign in to comment.