This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-13
Channels
- # announcements (18)
- # babashka (52)
- # beginners (47)
- # calva (45)
- # clj-kondo (31)
- # clojure (18)
- # clojure-brasil (2)
- # clojure-europe (3)
- # clojure-sweden (25)
- # clojurescript (19)
- # cursive (15)
- # datalevin (11)
- # defnpodcast (2)
- # duct (1)
- # editors (1)
- # emacs (6)
- # gratitude (1)
- # introduce-yourself (6)
- # jobs-discuss (11)
- # leiningen (3)
- # lsp (10)
- # luminus (2)
- # off-topic (4)
- # podcasts-discuss (2)
- # reitit (2)
- # shadow-cljs (10)
- # sql (9)
- # xtdb (4)
I don’t think date before 1970 is possible, because we are storing dates in unix epoch time https://en.wikipedia.org/wiki/Unix_time
Thanks, @huahaiy! Is this because LMDB is written in C? I'm trying to wrap my head around the JavaScript origin of DataScript, C of LMDB, and Clojure of Datalevin 😉
@huahaiy (and @nkabir): if lmdb is storing only bytes then it's up to us (the app) to interpret thoese bytes how we want, no? :If we choose to interpret 8 bytes as an instant from 1970 - then yes, we can't refer to older dates. If we choose to store and interpret 8 bytes as a date only (no time) we get a very big range. One example is PostgreSQL's date and time: https://www.postgresql.org/docs/13/datatype-datetime.html .
timestamp [ (p) ] with time zone 8 bytes both date and time, with time zone 4713 BC 294276 AD 1 microsecond
date 4 bytes date (no time of day) 4713 BC 5874897 AD 1 day
interval [ fields ] [ (p) ] 16 bytes time interval -178000000 years 178000000 years 1 microsecond
btw @huahaiy: does data levin offer any support for the new java time api https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html ?
I imagine it uses java.util.Date for compatibility reasons.
Looking at the API, one might be able to de/serialzie new Java time API's by implementing a custom
https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalAccessor.html - to read date from raw bytes stored in a lmdb buffer.
and using e.g localdate.from(TemporalAccessor)
method https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#from-java.time.temporal.TemporalAccessor- .
Would this be something usefull ?
> timestamp [ (p) ] with time zone 8 bytes both date and time, with time zone 4713 BC 294276 AD 1 microsecond @eugen.stan this range is more than sufficient for anything I would need. I am implementing the examples from http://www.learndatalogtoday.org/ They are storing birthdays in the #inst field. It would be nice to retain as much fidelity as possible with their examples. If someone can point me to the relevant logic in Datalevin, I can try to create a pull request (assuming @huahaiy supports the idea). Also, I can create a gist for the Datalevin Github with those implementations (and workarounds) to help people understand how to use this library. It is a great piece of software.
I would be happy to help - initially with testing and maybe some review. I also think lmdb and datalevin are great.
I initially created an issue here. Dennis asked me to post here. It may be easier to track this with the issue but I'll follow whatever convention the community prefers. https://github.com/juji-io/datalevin/issues/94