{"id":19998115,"url":"https://github.com/gob52/gob_datetime","last_synced_at":"2025-09-03T08:38:45.977Z","repository":{"id":160341300,"uuid":"576968256","full_name":"GOB52/gob_datetime","owner":"GOB52","description":"date-time classes like Java JSR 310 for C++11 or later. (Not all methods are available in all java.time classes )","archived":false,"fork":false,"pushed_at":"2023-11-02T14:41:13.000Z","size":139,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T12:42:11.841Z","etag":null,"topics":["arduino","arduino-library","cpp","datetime","jsr-310"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GOB52.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-12-11T15:14:16.000Z","updated_at":"2022-12-18T03:08:21.000Z","dependencies_parsed_at":"2023-11-02T15:35:41.106Z","dependency_job_id":null,"html_url":"https://github.com/GOB52/gob_datetime","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_datetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_datetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_datetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GOB52%2Fgob_datetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GOB52","download_url":"https://codeload.github.com/GOB52/gob_datetime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241435159,"owners_count":19962407,"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","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":["arduino","arduino-library","cpp","datetime","jsr-310"],"created_at":"2024-11-13T05:07:24.914Z","updated_at":"2025-03-01T23:10:25.846Z","avatar_url":"https://github.com/GOB52.png","language":"C++","readme":"# gob_datetime\n[In Japanese](README.md)  \n\ndate-time classes like Java JSR-310 for C++11 or later.  \nIt can be used in native and embedded (M5Stack) environments.\n\n\n## What is the JSR-310?\n[JSR-310](https://jcp.org/en/jsr/detail?id=310) is a package for handling date time time zone implemented in [java.time](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/time/package-summary.html) since Java 8.  \nIt is a very sophisticated design, so I tried to imitate it.\n\n## Restrictions\nNot all java.time related classes are covered yet. Not all methods are implemented either.\n\nClasses currently implemented\n- LocalDate\n- LocalTime\n- OffsetTime\n- ZoneOffset\n- LocalDateTime\n- OffsetDateTime\n\nLimited by the size of **time_t** in the environment in which it is used. If time_t is 32-bit, [the year 2038 problem](https://en.wikipedia.org/wiki/Year_2038_problem) occurs.  \nI Will implement other classes of java.time, such as ZonedDateTime.\n\n## How to install\ngit clone or extract zip file to your library folder.  \nIf you are using PlatformIO, you can write the following to download automatically.\n\n```ini\nlib_deps = https://github.com/GOB52/gob_datetime.git @ ^0.1.0\n```\n\n## How to use\nPlease include **gob_datetime.hpp**.  \nnamespace is **goblib::datetime**.\n\n```cpp\n#include \u003ccstdio\u003e\n#include \u003cgob_datetime.hpp\u003e\nusing goblib::datetime::LocalDate;\nusing goblib::datetime::LocalTime;\nusing goblib::datetime::LocalDateTime;\nusing goblib::datetime::OffsetDateTime;\nusing goblib::datetime::ZoneOffset;\n\nint main()\n{\n\tauto p = goblib::datetime::locationToPOSIX(\"America/Los_Angeles\"); // =\u003e \"PST8PDT,M3.2.0,M11.1.0\"\n\tsetenv(\"TZ\", p ? p : \"\", 1);\n\ttzset(); // Set timezone by POSIX tz string.\n\n\tOffsetDateTime odt = OffsetDateTime::parse(\"2010-09-08T12:34:56+09:00\");\n\tLocalDate ld = odt.toLocalDate();\n\tLocalTime lt = odt.toLocalTime();\n\tZoneOffset zo = odt.offset();\n\tprintf(\"%s %s %s\\n\", ld.toString().c_str(), lt.toString().c_str(), zo.toString().c_str()); // 2010-09-08 12:34:56 +09:00\n\n\tLocalDateTime ldt = LocalDateTime::now();\n\tprintf(\"%d/%d/%d\\n\", ldt.year(), ldt.month(), ldt.day()); // e.g. 2022/12/12\n\n\treturn 0;\n}\n```\n\n## Documents\nYou can make documents by [Doxygen](https://www.doxygen.nl/index.html). Use my [Doxyfile](doc/Doxyfile).  \n[Sample sources](examples) will also help you understand.\n\n\n## UnitTest\nYou can run [GoogleTest](https://google.github.io/googletest/) using [platformio.ini](platformio.ini).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgob52%2Fgob_datetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgob52%2Fgob_datetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgob52%2Fgob_datetime/lists"}