Fork me on GitHub
#off-topic
<
2019-07-02
>
helios14:07:54

wow, cloudflare is down and with it 10% of all websites 😕

Aron14:07:02

for us too

Aron14:07:10

decentralized interwebs

Aron14:07:30

although we had fallback, so it's just slower

helios14:07:19

it seems to be back up now

helios14:07:46

the funny thing is that the DNSes are resolving, so logging in to their dashboard to switch them off would solve it.. but their website was down as well :man-shrugging:

Pedro Ramos14:07:45

AWS console down here...

souenzzo17:07:01

There is a easier way to turn inst into string? (edn/read-string {:readers {'inst str}} (pr-str (new Date)))

Alex Miller (Clojure team)18:07:34

you could use the Java APIs to format Dates (or convert to Instant and use the java.time APIs)

Alex Miller (Clojure team)18:07:48

it's not easier, but I'd say it's better

hiredman18:07:17

to be clear, you are not turning an inst in to a string, inst is a data literal tag that tags some serialized data

👍 4
hiredman18:07:23

you have some kind of object, a java.util.Date object (which clojure pr's as a string tagged with inst, but many other date/time kind of objects do as well), which you want to turn into a string formatted in some way

hiredman18:07:04

I think these days I might convert the Date to some kind of java.time type and then do whatever with that, I think the formater is saner there

hiredman18:07:27

for example the default .toString on java.time.Instant is very nice:

hiredman18:07:31

user=> (str (java.time.Instant/now))
"2019-07-02T18:32:06.378194Z"
user=>

souenzzo18:07:01

at clojure.tools.reader.default-data-readers there is a lot of ^:private methods to format inst into this string. supposing that they are really necessary, I dont want to replicate it in my code. It's not a performatic stuff, but I need the same string from #inst "..."

hiredman18:07:13

user=> (str (.toInstant (java.util.Date.)))
"2019-07-02T18:32:57.154Z"
user=>

❤️ 4
hiredman18:07:24

toInstant is newish

Alex Miller (Clojure team)18:07:34

We would not have written all that instant stuff today - we would have used java.time

Alex Miller (Clojure team)18:07:02

And that private stuff could be replaced in the future