What is a fairly efficient but most importantly a clean and concise way of generating a UTC timestamp as a long value (java primitive type).
I only need this to be accurate to the most precise millisecond value.
I would prefer to use java.time.ZonedDateTime as it is a clean way of obtaining a UTC timestamp and does not require any external date libraries like Joda or Apache which I do not want to use.
The 19 digits comprising the primitive long value will be broken down (formatted) as follows with an example:
2015 - 4 digit year with range 1000 - 9223. - no zero padding allowed to ensure length is always a 19 digit long value - 1000 is the minimum value of a four digit year - 9223 is the maximum value based on first four digits of Long.MAX_VALUE or 9223372036854775807 01 - 2 digit month with range 01 - 12 - zero padded to ensure 2 digits always - jan is 01 and dec is 12 20 - 2 digit day with range 01 - 31 - zero padded to ensure 2 digits always 07 - 2 digit hour with range 00 - 23 - zero padded to ensure 2 digits always - uses a 24 hour clock - 00 is 12 AM while 23 is 11 PM 00 - 2 digit minute with range 00 - 59 - zero padded to ensure 2 digits always 00 - 2 digit second with range 00 - 59 - zero padded to ensure 2 digits always 999 - 3 digit milliseconds with range 000 - 999 - zero padded to ensure 3 digits always 99 - only 2 digits left over from primitive long. Ignore these as they will be used internally as specialized counters within my program
My starting point is to use the following:
ZonedDateTime value = ZonedDateTime.now( ZoneOffset.UTC );