Skip to content

Commit f05a52e

Browse files
committed
fix format
1 parent eca9b1c commit f05a52e

File tree

13 files changed

+440
-385
lines changed

13 files changed

+440
-385
lines changed
+24-24
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
name: 'build-docs'
2-
description: 'Builds documentation using Doxygen'
1+
name: "build-docs"
2+
description: "Builds documentation using Doxygen"
33
inputs:
44
cmake_target:
5-
description: 'CMake documentation target'
5+
description: "CMake documentation target"
66
required: true
77
docs_dir:
8-
description: 'Path to documentation dir, relative to build_dir'
8+
description: "Path to documentation dir, relative to build_dir"
99
required: true
1010
github_token:
11-
description: 'GitHub token'
11+
description: "GitHub token"
1212
required: true
1313
build_dir:
14-
description: 'Build directory'
14+
description: "Build directory"
1515
required: false
16-
default: 'build'
16+
default: "build"
1717
cmake_configure_args:
18-
description: 'Additional CMake configure arguments'
18+
description: "Additional CMake configure arguments"
1919
required: false
20-
default: ''
20+
default: ""
2121
destination_dir:
22-
description: 'Directory name for deployed docs'
22+
description: "Directory name for deployed docs"
2323
required: false
24-
default: ''
24+
default: ""
2525
docs_branch:
26-
description: 'Documentation branch'
26+
description: "Documentation branch"
2727
required: false
28-
default: 'gh-pages'
28+
default: "gh-pages"
2929

3030
outputs:
3131
version:
32-
description: 'Version of the generated docs'
32+
description: "Version of the generated docs"
3333
value: ${{ steps.get-docs-version.outputs.version }}
3434

3535
runs:
3636
using: "composite"
3737
steps:
3838
- name: Install deps
3939
shell: bash
40-
run: |
41-
sudo apt install -y cmake
42-
sudo apt install -y wget
43-
cd ~
44-
wget -nv https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
45-
tar -xzf doxygen-1.10.0.linux.bin.tar.gz
46-
echo "$(pwd)/doxygen-1.10.0/bin" >> $GITHUB_PATH
40+
run: |
41+
sudo apt install -y cmake
42+
sudo apt install -y wget
43+
cd ~
44+
wget -nv https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
45+
tar -xzf doxygen-1.10.0.linux.bin.tar.gz
46+
echo "$(pwd)/doxygen-1.10.0/bin" >> $GITHUB_PATH
4747
4848
- name: CMake configuration
4949
shell: bash
50-
run: cmake ${{ inputs.cmake_configure_args }} -B ${{ inputs.build_dir }} -DCHRONO_PARSE_BUILD_DOCS=ON
50+
run: cmake ${{ inputs.cmake_configure_args }} -B ${{ inputs.build_dir }} -DCHRONO_PARSE_BUILD_DOCS=ON
5151

5252
- name: CMake build
5353
shell: bash
54-
run: cmake --build ${{ inputs.build_dir }} --target ${{ inputs.cmake_target }}
54+
run: cmake --build ${{ inputs.build_dir }} --target ${{ inputs.cmake_target }}
5555

5656
- name: Get docs version
5757
id: get-docs-version
@@ -76,4 +76,4 @@ runs:
7676
github_token: ${{ inputs.github_token }}
7777
publish_dir: ${{ inputs.build_dir }}/${{ inputs.docs_dir }}/${{ steps.get-docs-version.outputs.version }}
7878
destination_dir: ${{ steps.get-docs-version.outputs.version }}
79-
publish_branch: ${{ inputs.docs_branch }}
79+
publish_branch: ${{ inputs.docs_branch }}
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
name: 'update-redirect-page'
2-
description: 'Updates redirect HTML page'
1+
name: "update-redirect-page"
2+
description: "Updates redirect HTML page"
33
inputs:
44
github_token:
5-
description: 'GitHub token'
5+
description: "GitHub token"
66
required: true
77
target_url:
8-
description: 'Redirect target URL'
8+
description: "Redirect target URL"
99
temp_dir:
10-
description: 'Directory where redirect file will be generated'
10+
description: "Directory where redirect file will be generated"
1111
required: false
12-
default: 'redirect-dir'
12+
default: "redirect-dir"
1313
file_name:
14-
description: 'Generated file name'
14+
description: "Generated file name"
1515
required: false
16-
default: 'index.html'
16+
default: "index.html"
1717
destination_dir:
18-
description: 'Redirect file destination directory'
18+
description: "Redirect file destination directory"
1919
required: false
20-
default: ''
20+
default: ""
2121
docs_branch:
22-
description: 'Documentation branch'
22+
description: "Documentation branch"
2323
required: false
24-
default: 'gh-pages'
24+
default: "gh-pages"
2525

2626
runs:
2727
using: "composite"
2828
steps:
29-
- name: Generate redirect HTML
30-
shell: bash
31-
run: |
32-
mkdir ${{ inputs.temp_dir }}
33-
cat << EOF > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
34-
<!DOCTYPE html>
35-
<html lang="en">
36-
<head>
37-
<meta charset="UTF-8">
38-
<meta http-equiv="refresh" content="0; url=${{ inputs.target_url }}">
39-
<title>Redirecting...</title>
40-
</head>
41-
<body>
42-
<p>If you are not redirected automatically, <a href="${{ inputs.target_url }}">click here</a>.</p>
43-
</body>
44-
</html>
45-
EOF
29+
- name: Generate redirect HTML
30+
shell: bash
31+
run: |
32+
mkdir ${{ inputs.temp_dir }}
33+
cat << EOF > ${{ inputs.temp_dir }}/${{ inputs.file_name }}
34+
<!DOCTYPE html>
35+
<html lang="en">
36+
<head>
37+
<meta charset="UTF-8">
38+
<meta http-equiv="refresh" content="0; url=${{ inputs.target_url }}">
39+
<title>Redirecting...</title>
40+
</head>
41+
<body>
42+
<p>If you are not redirected automatically, <a href="${{ inputs.target_url }}">click here</a>.</p>
43+
</body>
44+
</html>
45+
EOF
4646
47-
- name: Deploy redirect page
48-
uses: peaceiris/actions-gh-pages@v4
49-
with:
50-
github_token: ${{ inputs.github_token }}
51-
publish_dir: ${{ inputs.temp_dir }}
52-
destination_dir: ${{ inputs.destination_dir }}
53-
publish_branch: ${{ inputs.docs_branch }}
54-
keep_files: true
47+
- name: Deploy redirect page
48+
uses: peaceiris/actions-gh-pages@v4
49+
with:
50+
github_token: ${{ inputs.github_token }}
51+
publish_dir: ${{ inputs.temp_dir }}
52+
destination_dir: ${{ inputs.destination_dir }}
53+
publish_branch: ${{ inputs.docs_branch }}
54+
keep_files: true

.github/actions/update-version-selector/action.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
name: 'update-version-selector'
2-
description: 'Updates version selector'
1+
name: "update-version-selector"
2+
description: "Updates version selector"
33
inputs:
44
github_token:
5-
description: 'GitHub token'
5+
description: "GitHub token"
66
required: true
77
temp_dir:
8-
description: 'Directory where version selector file will be generated'
8+
description: "Directory where version selector file will be generated"
99
required: false
10-
default: 'selector-dir'
10+
default: "selector-dir"
1111
file_name:
12-
description: 'Selector file name'
12+
description: "Selector file name"
1313
required: false
14-
default: 'version_selector.html'
14+
default: "version_selector.html"
1515
selector_id:
16-
description: 'select element id'
16+
description: "select element id"
1717
required: false
18-
default: 'versionSelector'
18+
default: "versionSelector"
1919
docs_branch:
20-
description: 'Documentation branch'
20+
description: "Documentation branch"
2121
required: false
22-
default: 'gh-pages'
22+
default: "gh-pages"
2323
outputs:
2424
versions_counter:
2525
description: "Number of existing versions"
@@ -53,4 +53,4 @@ runs:
5353
github_token: ${{ inputs.github_token }}
5454
publish_dir: ${{ inputs.temp_dir }}
5555
publish_branch: ${{ inputs.docs_branch }}
56-
keep_files: true
56+
keep_files: true

.github/workflows/c-cpp.yml

+23-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: C/C++ CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88

99
jobs:
1010
build_linux:
@@ -24,9 +24,27 @@ jobs:
2424
- { compiler: clang, version: 11, build_type: Release, cppstd: 11 }
2525
- { compiler: clang, version: 11, build_type: Release, cppstd: 14 }
2626
- { compiler: clang, version: 11, build_type: Release, cppstd: 17 }
27-
- { compiler: clang, version: 11, build_type: Debug, cppstd: 17, asan: OFF }
28-
- { compiler: clang, version: 12, build_type: Debug, cppstd: 17, asan: OFF }
29-
- { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF }
27+
- {
28+
compiler: clang,
29+
version: 11,
30+
build_type: Debug,
31+
cppstd: 17,
32+
asan: OFF,
33+
}
34+
- {
35+
compiler: clang,
36+
version: 12,
37+
build_type: Debug,
38+
cppstd: 17,
39+
asan: OFF,
40+
}
41+
- {
42+
compiler: clang,
43+
version: 15,
44+
build_type: Release,
45+
cppstd: 20,
46+
asan: OFF,
47+
}
3048
container:
3149
image: ${{ matrix.config.compiler == 'clang' && 'teeks99/clang-ubuntu' || matrix.config.compiler }}:${{ matrix.config.version }}
3250
name: "${{ matrix.config.compiler}} ${{ matrix.config.version }} (C++${{ matrix.config.cppstd }}, ${{ matrix.config.build_type }})"

.github/workflows/create-git-main-docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
id: build-docs
2020
uses: ./.github/actions/build-docs
2121
with:
22-
cmake_target: 'doc'
23-
docs_dir: 'doc/docs'
22+
cmake_target: "doc"
23+
docs_dir: "doc/docs"
2424
destination_dir: git-main
2525
github_token: ${{ secrets.GITHUB_TOKEN }}
2626

@@ -35,4 +35,4 @@ jobs:
3535
uses: ./.github/actions/update-redirect-page
3636
with:
3737
github_token: ${{ secrets.GITHUB_TOKEN }}
38-
target_url: git-main/index.html
38+
target_url: git-main/index.html

.trunk/trunk.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ lint:
2020
enabled:
2121
- clang-format@16.0.3
2222
- actionlint@1.7.1
23-
- checkov@3.2.141
23+
- checkov@3.2.144
2424
- git-diff-check
2525
- markdownlint@0.41.0
2626
- prettier@3.3.2

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@
5252
"iomanip": "cpp"
5353
},
5454
"cmake.generator": "Unix Makefiles"
55-
}
55+
}

README.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# chrono_parse
2-
parse date and times with {fmt} style into`std::chrono::time_point` {WIP}
2+
3+
parse date and times with {fmt} style into`std::chrono::time_point` {WIP}
34

45
## [Usage](https://godbolt.org/z/nb3qdMYza)
6+
57
```C++
68
#include "mgutility/chrono/parse.hpp"
79

@@ -17,27 +19,26 @@ int main() {
1719
```
1820

1921
## Format specifiers
20-
| Format Specifier | Explanation |
21-
|--|--|
22-
| `%Y` | parses **year** as a decimal number, e.g. 2023 |
23-
| `%m` | parses **month** as a decimal number, e.g. 05 |
24-
| `%d` | parses **day** as a decimal number, e.g. 14 |
25-
| `%H` | parses **hour** as a decimal number, e.g. 16 |
26-
| `%M` | parses **minute** as a decimal number, e.g. 31 |
27-
| `%S` | parses **second** as a decimal number, e.g. 59 |
28-
| `%F` | parses **year-month-day** as an iso8601 date, e.g. 2023-05-04 |
29-
| `%T` | parses **hour:minute:second** as an iso8601 time, e.g. 16:31:59 |
30-
| `%f` | parses **milliseconds** as a decimal number, e.g. 869 |
31-
| `%z` | parses **timezone** as a decimal number, e.g. +0100 or -01:00 or Z |
22+
23+
| Format Specifier | Explanation |
24+
| ---------------- | ------------------------------------------------------------------ |
25+
| `%Y` | parses **year** as a decimal number, e.g. 2023 |
26+
| `%m` | parses **month** as a decimal number, e.g. 05 |
27+
| `%d` | parses **day** as a decimal number, e.g. 14 |
28+
| `%H` | parses **hour** as a decimal number, e.g. 16 |
29+
| `%M` | parses **minute** as a decimal number, e.g. 31 |
30+
| `%S` | parses **second** as a decimal number, e.g. 59 |
31+
| `%F` | parses **year-month-day** as an iso8601 date, e.g. 2023-05-04 |
32+
| `%T` | parses **hour:minute:second** as an iso8601 time, e.g. 16:31:59 |
33+
| `%f` | parses **milliseconds** as a decimal number, e.g. 869 |
34+
| `%z` | parses **timezone** as a decimal number, e.g. +0100 or -01:00 or Z |
3235

3336
## Notes
37+
3438
- Currently not supported all format specifiers (at least ISO-8601 capable now)
3539

3640
## [Performance](https://quick-bench.com/q/ry5gUzPplSBQenbLVBqRt1ns2-k)
41+
3742
- Performance is ~50x faster than `std::get_time` + `std::mktime`.
3843

3944
![ry5gUzPplSBQenbLVBqRt1ns2-k](https://user-images.githubusercontent.com/12413639/234938992-93cd1cb0-3a17-4466-99ae-b08cd3d3c8ff.png)
40-
41-
42-
43-

0 commit comments

Comments
 (0)