As Wakey said, it is impractical to trust a client’s watch. And not necessary in your case.
Your second suggestion:
When a client performs a specific action, I use Date.getTime () to register the time it took to execute and send it to the server.
... has a downside. The server application must manage the log and send faxes to the client.
, Java, Joda-Time, UTC. ISO 8601 . , , epoch - Unix, .
, - . , . - - .
, , , .
- , : .
org.joda.time.DateTime now = new org.joda.time.DateTime();
org.joda.time.DateTime utc = now.toDateTime( org.joda.time.DateTimeZone.UTC );
System.out.println( "Server default local time in ISO 8601 format: " + now );
System.out.println( "UTC (Zulu) time zone: " + utc );
...
Server default local time in ISO 8601 format: 2013-11-08T19:50:56.990-08:00
UTC (Zulu) time zone: 2013-11-09T03:50:56.990Z
, .
Joda-Time ISO 8601. .
java.util.Date -, Joda-Time Date.
org.joda.time.DateTimeZone romeTimeZone = org.joda.time.DateTimeZone.forID("Europe/Rome");
org.joda.time.DateTime userDateTime = utc.toDateTime( romeTimeZone );
System.out.println( "In User time zone: " + userDateTime );
...
In User time zone: 2013-11-09T04:50:56.990+01:00
Joda-Time :
// Joda-Time - The popular alternative to Sun/Oracle notoriously bad date, time, and calendar classes bundled with Java 7 and earlier.
// http://www.joda.org/joda-time/
// Joda-Time will become outmoded by the JSR 310 Date and Time API introduced in Java 8.
// JSR 310 was inspired by Joda-Time but is not directly based on it.
// http://jcp.org/en/jsr/detail?id=310
// By default, Joda-Time produces strings in the standard ISO 8601 format.
// https://en.wikipedia.org/wiki/ISO_8601
// About Daylight Saving Time (DST): https://en.wikipedia.org/wiki/Daylight_saving_time
// Time Zone list: http://joda-time.sourceforge.net/timezones.html
. . . , , , ( ).