https://github.com/beached/iso8601_parsing
Parse ISO 8601 combined data time strings
https://github.com/beached/iso8601_parsing
Last synced: 2 months ago
JSON representation
Parse ISO 8601 combined data time strings
- Host: GitHub
- URL: https://github.com/beached/iso8601_parsing
- Owner: beached
- License: mit
- Created: 2018-03-29T11:37:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-15T19:43:28.000Z (about 3 years ago)
- Last Synced: 2025-01-07T21:12:33.259Z (4 months ago)
- Language: C++
- Size: 236 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
### ISO 8601 Parsing
## Requirements
Because of the use of ```std::string_view``` the library requires C++ 17.## Build instructions
* 1 - ``` ./make_deps.sh (requires bash based shell) ```
* 2 - ``` mkdir build ```
* 3 - ``` cd build ```
* 4 - ``` cmake .. ```
* 5 - ``` make ```## Testing
From the build directory# Compare performance to a generic parser method using date::parse
```
./benchmarks ./timestamps.txt ../javascipt_ts_test.txt
```
# Simple verifications
```
./iso8601_test
```# Library Interface
``` C++
#include "iso8601_timestamps.h"
```Generic ISO 8601 Timestamp parser. Will throw ```invalid_iso8601_timestamp``` if the format is unrecognized.
``` C++
constexpr std::chrono::time_point
parse_iso8601_timestamp( std::string_view timestamp_str );
```Restricted Javascript flavor of ISO8601 timestamps parser. Will throw ```invalid_javascript_timestamp``` if it doesn't adhere to the format used by Javascript.
``` C++
constexpr std::chrono::time_point
parse_javascript_timestamp( std::string_view timestamp_str );
```