> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-8a08bda2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> sub-second precision으로 시간 범위를 저장하는 ClickHouse Time64 데이터 타입 문서

# Time64

데이터 타입 `Time64`는 소수 초를 포함한 시각(time-of-day)을 나타냅니다.
달력 날짜 구성 요소(일, 월, 연도)는 포함하지 않습니다.
`precision` 매개변수는 소수 자릿수를 정의하며, 이에 따라 틱 크기도 결정됩니다.

틱 크기(precision): 10<sup>-precision</sup>초. 유효 범위: 0..9입니다. 일반적으로 3(밀리초), 6(마이크로초), 9(나노초)를 사용합니다.

**구문:**

```sql theme={null}
Time64(precision)
```

내부적으로 `Time64`는 소수 초를 나타내는 부호 있는 64비트 Decimal(Decimal64) 값을 저장합니다.
틱 해상도는 `precision` 매개변수로 결정됩니다.
`Time64`는 시간대를 지원하지 않습니다. `Time64`에 시간대를 지정하면 오류가 발생합니다.

`DateTime64`와 달리 `Time64`는 날짜 구성 요소를 저장하지 않습니다.
관련 항목 [`Time`](/ko/reference/data-types/time).

텍스트 표현 범위: `precision = 3`일 때 \[-999:59:59.000, 999:59:59.999]입니다. 일반적으로 최솟값은 `-999:59:59`, 최댓값은 `999:59:59`이며, 소수 자릿수는 최대 `precision`까지 지원됩니다 (`precision = 9`이면 최솟값은 `-999:59:59.999999999`입니다).

<div id="implementation-details">
  ## 구현 세부 정보
</div>

**표현 방식**.
소수부 자릿수가 `precision`인 초 단위 분수를 저장하는 부호 있는 `Decimal64` 값입니다.

**정규화**.
문자열을 `Time64`로 구문 분석할 때 시간 구성 요소는 정규화되며 유효성 검사는 수행되지 않습니다.
예를 들어 `25:70:70`은 `26:11:10`으로 해석됩니다.

**음수 값**.
앞의 마이너스 기호가 지원되며 그대로 유지됩니다.
음수 값은 일반적으로 `Time64` 값에 대한 산술 연산으로 인해 발생합니다.
`Time64`에서는 텍스트 입력(예: `'-01:02:03.123'`)과 숫자 입력(예: `-3723.123`) 모두에서 음수 입력이 그대로 유지됩니다.

**포화**.
구성 요소로 변환하거나 텍스트로 직렬화할 때 하루 중 시간(time-of-day) 구성 요소는 \[-999:59:59.xxx, 999:59:59.xxx] 범위로 제한됩니다.
저장된 숫자 값은 이 범위를 초과할 수 있지만, 구성 요소 추출(시, 분, 초)과 텍스트 표현에는 포화된 값이 사용됩니다.

**시간대**.
`Time64`는 시간대를 지원하지 않습니다.
`Time64` 유형이나 값을 생성할 때 시간대를 지정하면 오류가 발생합니다.
마찬가지로 `Time64` 컬럼에 시간대를 적용하거나 변경하려는 시도도 지원되지 않으며 오류가 발생합니다.

<div id="examples">
  ## 예시
</div>

1. `Time64` 유형의 컬럼이 있는 테이블을 생성하고 데이터를 삽입하는 예시:

```sql theme={null}
CREATE TABLE tab64
(
    `event_id` UInt8,
    `time` Time64(3)
)
ENGINE = TinyLog;
```

```sql theme={null}
-- Time64 파싱
-- - 문자열로부터,
-- - 00:00:00 이후의 초(소수 부분은 정밀도에 따름)로부터.
INSERT INTO tab64 VALUES (1, '14:30:25'), (2, 52225.123), (3, '14:30:25');

SELECT * FROM tab64 ORDER BY event_id;
```

```text theme={null}
   ┌─event_id─┬────────time─┐
1. │        1 │ 14:30:25.000 │
2. │        2 │ 14:30:25.123 │
3. │        3 │ 14:30:25.000 │
   └──────────┴──────────────┘
```

2. `Time64` 값에 대한 필터링

```sql theme={null}
SELECT * FROM tab64 WHERE time = toTime64('14:30:25', 3);
```

```text theme={null}
   ┌─event_id─┬────────time─┐
1. │        1 │ 14:30:25.000 │
2. │        3 │ 14:30:25.000 │
   └──────────┴──────────────┘
```

```sql theme={null}
SELECT * FROM tab64 WHERE time = toTime64(52225.123, 3);
```

```text theme={null}
   ┌─event_id─┬────────time─┐
1. │        2 │ 14:30:25.123 │
   └──────────┴──────────────┘
```

참고: `toTime64`는 지정된 정밀도에 따라 숫자 리터럴을 소수 부분이 있는 초 단위 값으로 해석하므로, 의도한 소수 자릿수를 명시적으로 지정하십시오.

3. 결과 유형 확인:

```sql theme={null}
SELECT CAST('14:30:25.250' AS Time64(3)) AS column, toTypeName(column) AS type;
```

```text theme={null}
   ┌────────column─┬─type──────┐
1. │ 14:30:25.250 │ Time64(3) │
   └───────────────┴───────────┘
```

<div id="addition-with-date">
  ## Date와의 덧셈
</div>

[Time64](/ko/reference/data-types/time64) 값은 [Date](/ko/reference/data-types/date) 또는 [Date32](/ko/reference/data-types/date32) 값에 더할 수 있으며, 그 결과 `Time64`와 동일한 scale을 가진 [DateTime64](/ko/reference/data-types/datetime64)가 생성됩니다:

```sql theme={null}
SET use_legacy_to_time = 0;
SELECT toDate('2024-07-15') + toTime64('14:30:25.123456', 6) AS dt, toTypeName(dt);
```

```text theme={null}
   ┌─────────────────────────dt─┬─toTypeName(dt)─┐
1. │ 2024-07-15 14:30:25.123456 │ DateTime64(6)  │
   └────────────────────────────┴────────────────┘
```

지원되는 모든 조합과 결과 타입에 대한 자세한 내용은 [날짜 및 시간 덧셈](/ko/reference/operators#date-time-addition)을 참조하십시오.

**관련 항목**

* [타입 변환 함수](/ko/reference/functions/regular-functions/type-conversion-functions)
* [날짜 및 시간을 처리하는 함수](/ko/reference/functions/regular-functions/date-time-functions)
* [`date_time_input_format` 설정](/ko/reference/settings/formats#date_time_input_format)
* [`date_time_output_format` 설정](/ko/reference/settings/formats#date_time_output_format)
* [`timezone` 서버 구성 매개변수](/ko/reference/settings/server-settings/settings#timezone)
* [`session_timezone` 설정](/ko/reference/settings/session-settings#session_timezone)
* [날짜 및 시간을 처리하는 연산자](/ko/reference/operators#operators-for-working-with-dates-and-times)
* [`Date` 데이터 타입](/ko/reference/data-types/date)
* [`Time` 데이터 타입](/ko/reference/data-types/time)
* [`DateTime` 데이터 타입](/ko/reference/data-types/datetime)
