{"id":16572095,"url":"https://github.com/eddelbuettel/rcppcctz","last_synced_at":"2025-09-03T14:37:45.582Z","repository":{"id":49377986,"uuid":"44436401","full_name":"eddelbuettel/rcppcctz","owner":"eddelbuettel","description":"Rcpp interface to CCTZ library","archived":false,"fork":false,"pushed_at":"2025-03-11T00:08:41.000Z","size":464,"stargazers_count":22,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-19T18:11:27.437Z","etag":null,"topics":["c-plus-plus-11","cctz","cran","datetime","datetimes","r","rcpp","timezone","timezones"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddelbuettel.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-17T12:34:28.000Z","updated_at":"2025-03-11T00:08:45.000Z","dependencies_parsed_at":"2024-10-26T20:28:56.938Z","dependency_job_id":"994cd5ee-d0e2-4d47-ba32-65c9d441ba44","html_url":"https://github.com/eddelbuettel/rcppcctz","commit_stats":{"total_commits":146,"total_committers":7,"mean_commits":"20.857142857142858","dds":"0.12328767123287676","last_synced_commit":"5007c72ffa3bc8a4cecef55dfb598b2e10318c6a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eddelbuettel/rcppcctz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcctz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcctz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcctz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcctz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddelbuettel","download_url":"https://codeload.github.com/eddelbuettel/rcppcctz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcctz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273457711,"owners_count":25109292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus-11","cctz","cran","datetime","datetimes","r","rcpp","timezone","timezones"],"created_at":"2024-10-11T21:26:20.508Z","updated_at":"2025-09-03T14:37:45.507Z","avatar_url":"https://github.com/eddelbuettel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## RcppCCTZ: Rcpp bindings for [CCTZ](https://github.com/google/cctz)\n\n[![CI](https://github.com/eddelbuettel/rcppcctz/workflows/ci/badge.svg)](https://github.com/eddelbuettel/rcppcctz/actions?query=workflow%3Aci)\n[![License](https://eddelbuettel.github.io/badges/GPL2+.svg)](https://www.gnu.org/licenses/gpl-2.0.html)\n[![CRAN](https://www.r-pkg.org/badges/version/RcppCCTZ)](https://cran.r-project.org/package=RcppCCTZ)\n[![Dependencies](https://tinyverse.netlify.app/badge/RcppCCTZ)](https://cran.r-project.org/package=RcppCCTZ)\n[![Downloads](https://cranlogs.r-pkg.org/badges/RcppCCTZ?color=brightgreen)](https://www.r-pkg.org/pkg/RcppCCTZ)\n[![Last Commit](https://img.shields.io/github/last-commit/eddelbuettel/rcppcctz)](https://github.com/eddelbuettel/rcppcctz)\n\n### What is CCTZ?\n\n[CCTZ](https://github.com/google/cctz) (C++ Time Zone) is an excellent (yet small) C++11 library for\ntranslating between absolute times and civil times using the rules defined by a time zone. See its\n[repository](https://github.com/google/cctz) (as well as code) for very detailed documentation.\n[CCTZ](https://github.com/google/cctz) is being developed by Google but not an officially endorsed product.\n\n### What is RcppCCTZ?\n\nThis package wraps CCTZ for use by R via [Rcpp](https://dirk.eddelbuettel.com/code/rcpp.html).\n\n### Examples\n\n#### Difference between Timezones\n\n```r\nR\u003e # simple call: difference now\nR\u003e tzDiff(\"America/New_York\", \"Europe/London\", Sys.time())\n[1] 5\nR\u003e # tabulate difference for every week of the year\nR\u003e table(sapply(0:52, function(d) tzDiff(\"America/New_York\", \"Europe/London\",\n+                                        as.POSIXct(as.Date(\"2016-01-01\") + d*7))))\n\n 4  5\n 3 50\n```\n\n#### Shifting Timezone\n\n```r\nR\u003e # Given current time in NY what is the time London, UK\nR\u003e # (running the code locally in Chicago hence CST text format)    \nR\u003e toTz(Sys.time(), \"America/New_York\", \"Europe/London\") \t\n[1] \"2016-12-10 17:15:04.20370 CST\"\nR\u003e # this redoes the 'Armstrong on the moon in NYC and Sydney' example\nR\u003e # note that the default print method will print the return object in _your local time_\nR\u003e toTz(ISOdatetime(1969,7,20,22,56,0,tz=\"UTC\"), \"America/New_York\", \"Australia/Sydney\", TRUE)\n1969-07-20 22:56:00 -0400\n1969-07-21 12:56:00 +1000\n[1] \"1969-07-20 21:56:00 CDT\"\nR\u003e # whereas explicitly formating for Sydney time does the right thing\nR\u003e format(toTz(ISOdatetime(1969,7,20,22,56,0,tz=\"UTC\"),\n+             \"America/New_York\", \"Australia/Sydney\", verbose=TRUE),\n+        tz=\"Australia/Sydney\")\n1969-07-20 22:56:00 -0400\n1969-07-21 12:56:00 +1000\n[1] \"1969-07-21 12:56:00\"\n```\n\n#### Parsing and Formatting\n\n```r\nR\u003e now \u003c- Sys.time()\nR\u003e formatDatetime(now)            # current (UTC) time, in full precision RFC3339\n[1] \"2016-12-10T18:23:03.327956+00:00\"\nR\u003e formatDatetime(now, tgttzstr=\"America/New_York\")  # same but in NY\n[1] \"2016-12-10T13:23:03.327956-05:00\"\nR\u003e formatDatetime(now + 0:4)\t   # vectorised\n[1] \"2016-12-10T18:23:03.327956+00:00\" \"2016-12-10T18:23:04.327956+00:00\"\n[3] \"2016-12-10T18:23:05.327956+00:00\" \"2016-12-10T18:23:06.327956+00:00\"\n[5] \"2016-12-10T18:23:07.327956+00:00\"\nR\u003e\n\nR\u003e ds \u003c- getOption(\"digits.secs\")\nR\u003e options(digits.secs=6) # max value\nR\u003e parseDatetime(\"2016-12-07 10:11:12\",        \"%Y-%m-%d %H:%M:%S\");   # full seconds\n[1] \"2016-12-07 04:11:12 CST\"\nR\u003e parseDatetime(\"2016-12-07 10:11:12.123456\", \"%Y-%m-%d %H:%M:%E*S\"); # fractional seconds\n[1] \"2016-12-07 04:11:12.123456 CST\"\nR\u003e parseDatetime(\"2016-12-07T10:11:12.123456-00:00\")  ## default RFC3339 format\n[1] \"2016-12-07 04:11:12.123456 CST\"\nR\u003e now \u003c- trunc(Sys.time())\nR\u003e parseDatetime(formatDatetime(now + 0:4))\t   \t\t\t# vectorised\n[1] \"2016-12-10 12:24:25 CST\" \"2016-12-10 12:24:26 CST\" \"2016-12-10 12:24:27 CST\"\n[4] \"2016-12-10 12:24:28 CST\" \"2016-12-10 12:24:29 CST\"\nR\u003e options(digits.secs=ds)\n\n```\n\n### Requirements\n\nThe [CCTZ](https://github.com/google/cctz) library depends on timezone files typically found in\n`/usr/share/zoneinfo` which requires a Unix-alike OS such as Linux or OS X. Old school Unix variants\nmay work.\n\n### Status\n\nOn [CRAN](https://cran.r-project.org/package=RcppCCTZ), builds and tests cleanly,\nand the example functions are accessible from R.\n\n### Installation\n\nThe package is now on [CRAN](https://cran.r-project.org) and can be installed\nvia a standard\n\n```r\ninstall.packages(\"RcppCCTZ\")\n```\n\n### Continued Testing\n\nAs we rely on the [tinytest](https://cran.r-project.org/package=tinytest) package, the\nalready-installed package can also be verified via\n\n```r\ntinytest::test_package(\"RcppCCTZ\")\n```\n\nat any later point.\n\n### Author\n\nDirk Eddelbuettel\n\n### License\n\nGPL (\u003e= 2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppcctz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddelbuettel%2Frcppcctz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppcctz/lists"}