4 ms·
Well, let's clarify something - is it the syntax or the self-algorithm? To compare, this is what a psuedo-popular-lang might look like: let year = parse-
by martinflack 5y ago
Well, let's clarify something - is it the syntax or the self-algorithm?
To compare, this is what a psuedo-popular-lang might look like:
let year = parse-integer(string, start=0, end=4)
let month = parse-integer(string, start=7, end=7)
let day = parse-integer(string, start=9, end=10)
return ((year * 31556926 + ;; no. of seconds in a year
month * 2629743 + ;; no. of seconds in a month
day * 86400) - ;; no. of seconds in a day
1900 * 31556926) ;; lisp timestamps start at 1900
Honestly that looks pretty run-of-the-mill to me.
Having said that, rolling your own date logic is insanity, as the problem is difficult[1] yet solved[2].
[1] https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b...
[2] https://common-lisp.net/project/local-time/manual.html https://common-lisp.net/project/local-time/manual.html