You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2025/11/03 04:03:42 UTC

(fory-site) branch main updated: 🔄 synced local 'docs/specification/' with remote 'docs/specification/'

This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git


The following commit(s) were added to refs/heads/main by this push:
     new aedcaf1e9 🔄 synced local 'docs/specification/' with remote 'docs/specification/'
aedcaf1e9 is described below

commit aedcaf1e938ee3becca31a414d7a220ea552679d
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Mon Nov 3 04:03:38 2025 +0000

    🔄 synced local 'docs/specification/' with remote 'docs/specification/'
---
 docs/specification/xlang_serialization_spec.md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/specification/xlang_serialization_spec.md b/docs/specification/xlang_serialization_spec.md
index 9ab038c6a..297f9b627 100644
--- a/docs/specification/xlang_serialization_spec.md
+++ b/docs/specification/xlang_serialization_spec.md
@@ -597,6 +597,26 @@ Which encoding to choose:
 - If the string is encoded by `utf-8`, then fory will use `utf-8` to decode the data. Cross-language string
   serialization of fory uses `utf-8` by default.
 
+### duration
+
+Duration is an absolute length of time, independent of any calendar/timezone, as a count of seconds and nanoseconds.
+
+Format:
+
+```
+| signed varint64: seconds | signed int32: nanoseconds |
+```
+
+- `seconds`: Number of seconds in the duration, encoded as a signed varint64. Can be positive or negative.
+- `nanoseconds`: Nanosecond adjustment to the duration, encoded as a signed int32. Value range is [0, 999,999,999] for positive durations, and [-999,999,999, 0] for negative durations.
+
+Notes:
+
+- The duration is stored as two separate fields to maintain precision and avoid overflow issues.
+- Seconds are encoded using varint64 for compact representation of common duration values.
+- Nanoseconds are stored as a fixed int32 since the range is limited.
+- The sign of the duration is determined by the seconds field. When seconds is 0, the sign is determined by nanoseconds.
+
 ### collection/list
 
 Format:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org