Fork me on GitHub
#pedestal
<
2017-08-16
>
souenzzo18:08:39

there is somehow to get a now/`instant` from context? (maybe from servlet).

bherrmann21:08:53

user=> (System/currentTimeMillis) 1502917425089

souenzzo01:08:32

is possible to get the same value that is used on Date: header?

bherrmann12:08:24

I'm not sure what you are asking. You mean you want it (the instance) formatted like,

bherrmann12:08:25

Date: Wed, 15 Nov 1995 06:25:24 GMT

bherrmann12:08:46

Humm ... for java 8 stack overflow says,

bherrmann12:08:47

Instant instant = Instant.now(); String formatted = DateTimeFormatter.RFC_1123_DATE_TIME .withZone(ZoneOffset.UTC) .format(instant); System.out.println(formatted);

souenzzo13:08:35

Nooo. I want the same instant. Same var. My actual code (assoc-in ctx [:request :inst] (time/now)). I want to know if is possible to do: (assoc-in ctx [:request :inst] (.getTime servlet)). Just to audit the same time as used in jetty/http. But I'm not sure if it's generated after or before my interceptor chain, nor where it "stored".