Skip to content

Commit

Permalink
[AVRO-4043] Add time-nanos logical type
Browse files Browse the repository at this point in the history
  • Loading branch information
glywk committed Aug 28, 2024
1 parent c7b79bf commit 9d33980
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions doc/content/en/docs/++version++/Specification/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,18 +860,16 @@ The following schema represents a date:
}
```

### Time (millisecond precision) {#time_ms}
The `time-millis` logical type represents a time of day, with no reference to a particular calendar, time zone or date, with a precision of one millisecond.
### Times {#times}{#time_ms}
The `time-{millis,micros,nanos}` logical type represents a time of day, with no reference to a particular calendar, time zone or date.

A `time-millis` logical type annotates an Avro `int`, where the int stores the number of milliseconds after midnight, 00:00:00.000.

### Time (microsecond precision)
The `time-micros` logical type represents a time of day, with no reference to a particular calendar, time zone or date, with a precision of one microsecond.

A `time-micros` logical type annotates an Avro `long`, where the long stores the number of microseconds after midnight, 00:00:00.000000.

### Timestamps {#timestamps}
A `time-nanos` logical type annotates an Avro `long`, where the long stores the number of nanoseconds after midnight, 00:00:00.000000.

### Timestamps {#timestamps}
The `timestamp-{millis,micros,nanos}` logical type represents an instant on the global timeline, independent of a particular time zone or calendar. Upon reading a value back, we can only reconstruct the instant, but not the original representation. In practice, such timestamps are typically displayed to users in their local time zones, therefore they may be displayed differently depending on the execution environment.

- `timestamp-millis`: logical type annotates an Avro `long`, where the long stores the number of milliseconds from the unix epoch, 1 January 1970 00:00:00.000.
Expand All @@ -881,7 +879,6 @@ The `timestamp-{millis,micros,nanos}` logical type represents an instant on the
Example: Given an event at noon local time (12:00) on January 1, 2000, in Helsinki where the local time was two hours east of UTC (UTC+2). The timestamp is first shifted to UTC 2000-01-01T10:00:00 and that is then converted to Avro long 946720800000 (milliseconds) and written.

### Local Timestamps {#local_timestamp}

The `local-timestamp-{millis,micros,nanos}` logical type represents a timestamp in a local timezone, regardless of what specific time zone is considered local.

- `local-timestamp-millis`: logical type annotates an Avro `long`, where the long stores the number of milliseconds, from 1 January 1970 00:00:00.000.
Expand Down

0 comments on commit 9d33980

Please sign in to comment.