UTC_TIMESTAMP() rounds fraction part instead of truncating it
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
tidb> select utc_timestamp(6), utc_timestamp(), now(), now(6);
+----------------------------+---------------------+---------------------+----------------------------+
| utc_timestamp(6) | utc_timestamp() | now() | now(6) |
+----------------------------+---------------------+---------------------+----------------------------+
| 2024-10-01 08:31:57.868668 | 2024-10-01 08:31:58 | 2024-10-01 10:31:57 | 2024-10-01 10:31:57.868667 |
+----------------------------+---------------------+---------------------+----------------------------+
1 row in set (0.00 sec)
```
### 2. What did you expect to see? (Required)
`UTC_TIMESTAMP()` should never round up, it is very confusing if time is rounding up, since it will be earlier than what the clock on the wall shows.
### 3. What did you see instead (Required)
Truncating (or always rounding down).
### 4. What is your TiDB version? (Required)
```
tidb_version(): Release Version: v8.4.0-alpha-325-g74034d4ac2
Edition: Community
Git Commit Hash: 74034d4ac243b3c14dbf5f8a9edb92e740da4212
Git Branch: now-diff-utc_timestamp
UTC Build Time: 2024-10-01 08:23:56
GoVersion: go1.22.1
Race Enabled: false
Check Table Before Drop: false
Store: unistore
```
Contributor guide
Assessment
This issue has not been assessed yet.