Unix time conversions in C# [duplicate]

“Unix timestamp” means seconds since the epoch in most situations rather than milliseconds… be careful! However, things like Java use “milliseconds since the epoch” which may be what you actually care about – despite the tool you showed. It really depends on what you need. Additionally, you shouldn’t be doing anything with local time. Stick … Read more

How do I deserialize timestamps that are in seconds with Jackson?

I wrote a custom deserializer to handle timestamps in seconds (Groovy syntax). class UnixTimestampDeserializer extends JsonDeserializer<DateTime> { Logger logger = LoggerFactory.getLogger(UnixTimestampDeserializer.class) @Override DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String timestamp = jp.getText().trim() try { return new DateTime(Long.valueOf(timestamp + ‘000’)) } catch (NumberFormatException e) { logger.warn(‘Unable to deserialize timestamp: ‘ + timestamp, e) … Read more

What’s the point of a timestamp in OAuth if a Nonce can only be used one time?

The timestamp is used for allowing the server to optimize their storage of nonces. Basically, consider the read nonce to be the combination of the timestamp and random string. But by having a separate timestamp component, the server can implement a time-based restriction using a short window (say, 15 minutes) and limit the amount of … Read more

How to test if a given time-stamp is in seconds or milliseconds?

If you convert the maximum timestamp values with x digits in millis you get something like this: 9999999999999 (13 digits) means Sat Nov 20 2286 17:46:39 UTC 999999999999 (12 digits) means Sun Sep 09 2001 01:46:39 UTC 99999999999 (11 digits) means Sat Mar 03 1973 09:46:39 UTC Can your timestamps be older than 2001? If … Read more