ClojureScript

Instance Reader to Support Micro/Nanoseconds

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    N/A

Description

Any timestamps with a greater than millisecond precision cannot be handled by the ClouseScript reader:

> cljs.reader.read_date("2012-12-30T23:20:05.066980000-00:00")
> Error: Assert failed: timestamp millisecond field must be in range 0..999 Failed:  0<=66980000<=999 (<= low n high)

Here "2012-12-30T23:20:05.066980000-00:00" is an example of an ordinary timestamp that is returned from Postgres.

ClojureScript reader interprets the nanosecond portion "066980000" as milliseconds and the check here fails:

def parse-and-validate-timestamp
...
   (check 0 ms 999 "timestamp millisecond field must be in range 0..999")
  1. CLJS-454.diff
    31/Jul/13 4:21 AM
    6 kB
    Jonas Enlund
  2. CLJS-454-patch2.diff
    02/Aug/13 3:16 PM
    7 kB
    Jonas Enlund
  3. cljs-reader-nanosecond-workarround-corrected.patch
    05/Feb/13 3:37 PM
    1 kB
    Thomas Heller

Activity

People

Vote (4)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: