-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add time durations to reference (#1403)
- Loading branch information
Showing
7 changed files
with
98 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
keywords: [time durations, time spans, time units] | ||
description: Learn how GreptimeDB utilizes time durations to represent time spans in SQL queries, configuration files, and API requests with supported suffixes and examples. | ||
--- | ||
|
||
# Time Durations | ||
|
||
GreptimeDB utilizes time durations to represent time spans in various contexts, | ||
including SQL queries, configuration files, and API requests. | ||
A time duration is expressed as a string composed of concatenated time spans, | ||
each represented by a sequence of decimal numbers followed by a unit suffix. | ||
These suffixes are case-insensitive and support both singular and plural forms. For example, `1hour 12min 5s`. | ||
|
||
Each time span consists of an integer and a suffix. | ||
The supported suffixes are: | ||
|
||
- `nsec`, `ns`: nanoseconds | ||
- `usec`, `us`: microseconds | ||
- `msec`, `ms`: milliseconds | ||
- `seconds`, `second`, `sec`, `s` | ||
- `minutes`, `minute`, `min`, `m` | ||
- `hours`, `hour`, `hr`, `h` | ||
- `days`, `day`, `d` | ||
- `weeks`, `week`, `w` | ||
- `months`, `month`, `M`: defined as 30.44 days | ||
- `years`, `year`, `y`: defined as 365.25 days | ||
|
||
Appending a decimal integer with one of the above units represents the equivalent number of seconds as a bare float literal. | ||
Examples: | ||
|
||
- `1s`: Equivalent to 1 second | ||
- `2m`: Equivalent to 120 seconds | ||
- `1ms`: Equivalent to 0.001 seconds | ||
- `2h`: Equivalent to 7200 seconds | ||
|
||
The following examples are invalid: | ||
|
||
- `0xABm`: Hexadecimal numbers are not supported | ||
- `1.5h`: Floating point numbers are not supported | ||
- `+Infd`: `±Inf` or `NaN` values are not supported | ||
|
||
|
||
The following are some valid time duration examples: | ||
|
||
- `1h`: one hour | ||
- `1h30m`, `1h 30m`: one hour and thirty minutes | ||
- `1h30m10s`, `1h 30m 10s`: one hour, thirty minutes, and ten seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
i18n/zh/docusaurus-plugin-content-docs/current/reference/time-durations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
keywords: [时间范围, 时间跨度, 时间单位] | ||
description: 了解 GreptimeDB 中时间范围对象的表示方法,包括支持的时间单位和示例。 | ||
--- | ||
|
||
# 时间范围对象 | ||
|
||
GreptimeDB 使用时间范围对象来表示各种上下文中的时间跨度, | ||
包括 SQL 查询、配置文件和 API 请求。 | ||
时间持续时间表示为由连接的时间跨度组成的字符串, | ||
每个时间跨度由一个十进制数字序列和一个单位后缀表示。 | ||
这些后缀不区分大小写,并且支持单数和复数形式。例如,`1hour 12min 5s`。 | ||
|
||
每个时间跨度由一个整数和一个后缀组成。支持的后缀有: | ||
|
||
- `nsec`, `ns`: 纳秒 | ||
- `usec`, `us`: 微秒 | ||
- `msec`, `ms`: 毫秒 | ||
- `seconds`, `second`, `sec`, `s`: 秒 | ||
- `minutes`, `minute`, `min`, `m`: 分钟 | ||
- `hours`, `hour`, `hr`, `h`: 小时 | ||
- `days`, `day`, `d`: 天 | ||
- `weeks`, `week`, `w`: 周 | ||
- `months`, `month`, `M`: 定义为 30.44 天 | ||
- `years`, `year`, `y`: 定义为 365.25 天 | ||
|
||
在十进制整数后附加上述单位之一,表示等值的秒数。 | ||
例如: | ||
|
||
- `1s`: 等效于 1 秒 | ||
- `2m`: 等效于 120 秒 | ||
- `1ms`: 等效于 0.001 秒 | ||
- `2h`: 等效于 7200 秒 | ||
|
||
以下写法无效: | ||
|
||
- `0xABm`: 不支持十六进制数字 | ||
- `1.5h`: 不支持浮点数 | ||
- `+Infd`: 不支持 `±Inf` 或 `NaN` 值 | ||
|
||
以下是一些有效的时间范围示例: | ||
|
||
- `1h`: 一小时 | ||
- `1h30m`, `1h 30m`: 一小时三十分钟 | ||
- `1h30m10s`, `1h 30m 10s`: 一小时三十分钟十秒 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters