Inconsistent Instant <-> long conversion

Aperta Adatta ai principianti
#214 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
72/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
clojure
Ambito
documentation

Direzione di ricerca

Inizia individuando la documentazione e i docstring di t/long e t/instant, poi controlla le descrizioni esistenti delle unità dell’epoca. Chiarisci che t/long restituisce secondi, mentre un long passato a t/instant rappresenta millisecondi; il lavoro è concluso quando la documentazione rende esplicita questa differenza.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello,

I am currently migrating a codebase away from clj-time and I noticed something relative to Instant and long conversion. My point of reference has been clj-time.coerce/from-long and clj-time.coerce/to-long, which works with milliseconds to/from epoch.

What I observe in Tick is that t/long produces the number of seconds from epoch. Conversely, (t/instant ts) where ts is a long produces the Instant that is ts milliseconds from epoch. The direct consequence is that t/long and t/instant are not inverse functions of each other, and (-> (t/instant) t/to-long t/instant) will give you some date in 1970.

I do not know if either of those functions need to be fixed, and it is difficult to modify a production API anyway, but at least the documentation and docstrings should probably be more explicit.

Lingua principale
Clojure
Stelle
646
Fork
61
Merge medio
17h 42m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di juxt/tick

Tutte le issue di juxt/tick

Issue simili

Altre issue su Clojure

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.