personium / personium-core

Core module of Personium
https://personium.io
Apache License 2.0
88 stars 16 forks source link

Created/updated timestamps are saved in JST #42

Closed dixonsiu closed 7 years ago

dixonsiu commented 7 years ago

To support overseas client, it should be UTC.

For example, in Wakaba Client App's lm.isExpired, we tried to compare the expiry date of the timestamp with current time. If the application is executed in machine that use US time, we will have the wrong result.

shimono commented 7 years ago

I think it is saved in UTC format internally. Probably you are talking about PROPFIND result. PROPFIND response rendering somehow converts to local time format.

shimono commented 7 years ago

https://github.com/personium/personium-core/blob/93105d9491c6366e3c6f2686034ebc9bee204f33/src/main/java/io/personium/core/model/DavRsCmp.java#L506

Plz see above, Yes, It is handled in unix time interanally. but org.apache.wink.webdav.model.Getlastmodified automatically change to local time format.

I remember we took i18n (timezone) in consideration on initial implementation, also. We found out that wink library automatically converts to local date and could not find the way to force it to return in utc time. And considering the fact that it still returns timezone info in the format, we gave up and made it clients' responsibility to properly handle the info obtained from the server (time w/ timezone info) and present to user in preferable way (covert in accordance with client timezone)

shimono commented 7 years ago

Sorry i am not the one to close this issue.

Dixonsiu, if you are satisfied with the above answer, plz close this issue.

dixonsiu commented 7 years ago

The original question is to point out that client's local time is comparing with Personium Unit's local time. Normally UTC is preferable because client app does not know which value is UTC which value is local time. Unless all time value returned from the Personium Unit is local time with time zone, it is not an excuse to return certain time value in local time and certain time in UTC.

Wrong implementation:

  1. Use PROFIND result (local time of Personium Unit)
  2. Get client's current time (local time)
  3. Compare 1 & 2

Client solution based on the weird server implementation:

  1. Convert PROFIND result to UTC format using timezone information
  2. Get client's current time in UTC format
  3. Compare 1 & 2