diff options
| author | bt <bt@rctt.net> | 2026-06-04 16:11:03 +0200 |
|---|---|---|
| committer | bt <bt@rctt.net> | 2026-06-04 16:12:22 +0200 |
| commit | ed2621c17f353878ea86ce2c16cac7cd04fb4c6a (patch) | |
| tree | 21735f781749a3b2986fb8fbd44e9a3ef94d8a66 | |
| parent | 061b0ac8e8d1cefbb7ffcf3eb8695a28663cda3e (diff) | |
| download | solec-ed2621c17f353878ea86ce2c16cac7cd04fb4c6a.tar.gz solec-ed2621c17f353878ea86ce2c16cac7cd04fb4c6a.zip | |
[common] Include milliseconds in timestamps
| -rw-r--r-- | cmd/client/main.go | 3 | ||||
| -rw-r--r-- | core/data.go | 4 | ||||
| -rw-r--r-- | docs/rfc.html | 12 | ||||
| -rw-r--r-- | docs/rfc.md | 2 | ||||
| -rw-r--r-- | docs/rfc.txt | 7 |
5 files changed, 15 insertions, 13 deletions
diff --git a/cmd/client/main.go b/cmd/client/main.go index 15033ab..f135a69 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "log" "net" "strings" @@ -20,7 +21,7 @@ var ( type Handler struct{} func (h *Handler) HandleMessage(msg core.Message) { - log.Println("received message", msg.Source, "->", msg.Target, msg.Content) + fmt.Printf("%s\t%s -> %s %s\n", msg.Timestamp.Format("2006/01/02 15:04:05.000"), msg.Source, msg.Target, msg.Content) } func (h *Handler) HandleError(err error) { diff --git a/core/data.go b/core/data.go index fdad424..6871a89 100644 --- a/core/data.go +++ b/core/data.go @@ -93,7 +93,7 @@ func Encode(w Wrapper) ([]byte, error) { } case time.Time: - err := binary.Write(buf, binary.BigEndian, uint64(v.Unix())) + err := binary.Write(buf, binary.BigEndian, uint64(v.UnixMilli())) if err != nil { return []byte{}, fmt.Errorf("cannot encode time: %v", err) } @@ -168,7 +168,7 @@ func decodeTime(buf io.Reader, ptr *time.Time) error { return fmt.Errorf("cannot decode time: %v", err) } - *ptr = time.Unix(int64(timeBuf), 0) + *ptr = time.UnixMilli(int64(timeBuf)) return nil } diff --git a/docs/rfc.html b/docs/rfc.html index 224cbea..373526e 100644 --- a/docs/rfc.html +++ b/docs/rfc.html @@ -1216,11 +1216,11 @@ li > p:last-of-type:only-child { <thead><tr> <td class="left">Internet-Draft</td> <td class="center">SOLEC</td> -<td class="right">May 2026</td> +<td class="right">June 2026</td> </tr></thead> <tfoot><tr> <td class="left">bt</td> -<td class="center">Expires 2 December 2026</td> +<td class="center">Expires 6 December 2026</td> <td class="right">[Page]</td> </tr></tfoot> </table> @@ -1233,12 +1233,12 @@ li > p:last-of-type:only-child { <dd class="internet-draft">SOLEC</dd> <dt class="label-published">Published:</dt> <dd class="published"> -<time datetime="2026-05-31" class="published">31 May 2026</time> +<time datetime="2026-06-04" class="published">4 June 2026</time> </dd> <dt class="label-intended-status">Intended Status:</dt> <dd class="intended-status">Experimental</dd> <dt class="label-expires">Expires:</dt> -<dd class="expires"><time datetime="2026-12-02">2 December 2026</time></dd> +<dd class="expires"><time datetime="2026-12-06">6 December 2026</time></dd> <dt class="label-authors">Author:</dt> <dd class="authors"> <div class="author"> @@ -1274,7 +1274,7 @@ SOLEC system.<a href="#section-abstract-1" class="pilcrow">¶</a></p> time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."<a href="#section-boilerplate.1-3" class="pilcrow">¶</a></p> <p id="section-boilerplate.1-4"> - This Internet-Draft will expire on 2 December 2026.<a href="#section-boilerplate.1-4" class="pilcrow">¶</a></p> + This Internet-Draft will expire on 6 December 2026.<a href="#section-boilerplate.1-4" class="pilcrow">¶</a></p> </section> </div> <div id="copyright"> @@ -1523,7 +1523,7 @@ spec</a>. Following types are in use:<a href="#section-2.3.1-1" class="pilcrow"> <h4 id="name-timestamp"> <a href="#section-2.3.2" class="section-number selfRef">2.3.2. </a><a href="#name-timestamp" class="section-name selfRef">Timestamp</a> </h4> -<p id="section-2.3.2-1">Uint64 containing Unix timestamp in UTC timezone.<a href="#section-2.3.2-1" class="pilcrow">¶</a></p> +<p id="section-2.3.2-1">Uint64 containing Unix timestamp in UTC timezone. Milliseconds are included.<a href="#section-2.3.2-1" class="pilcrow">¶</a></p> <div class="lang-ascii-art sourcecode" id="section-2.3.2-2"> <pre> 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 diff --git a/docs/rfc.md b/docs/rfc.md index 5c9f9b0..d6c8085 100644 --- a/docs/rfc.md +++ b/docs/rfc.md @@ -117,7 +117,7 @@ Number in numeric type name is number of bits used to encode this type. ### Timestamp -Uint64 containing Unix timestamp in UTC timezone. +Uint64 containing Unix timestamp in UTC timezone. Milliseconds are included. ~~~ ascii-art 0 1 2 3 diff --git a/docs/rfc.txt b/docs/rfc.txt index ed9cc49..335ea3d 100644 --- a/docs/rfc.txt +++ b/docs/rfc.txt @@ -1,7 +1,7 @@ SOLEC Working Group bt, Ed. Internet-Draft RCTT.net -Intended status: Experimental 31 May 2026 -Expires: 2 December 2026 +Intended status: Experimental 4 June 2026 +Expires: 6 December 2026 System of Lightweight Electronic Communication @@ -129,7 +129,8 @@ Table of Contents 2.3.2. Timestamp - Uint64 containing Unix timestamp in UTC timezone. + Uint64 containing Unix timestamp in UTC timezone. Milliseconds are + included. 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
