I have a server which runs on Java and client which runs on python. When I connect the client and server I have to sync the time from server to client.
I was successful in connecting and sending streams from server to client. I wanted to know what is the usual way to send time and timezone. How can i do it? For now i am sending time in miliseconds and paring that in python to get the date and time. But I don’t know how to send time zone.
I have a server which runs on Java and client which runs on python.
Share
You should transmit and process the time in UTC and not mess with timezones at all. In Java, this is exactly what
System.currentTimeMillis()returns.Edit: The correct format to transfer timezone information is to use a continent/city ID as in the tz database, e.g. “America/New_York” or “Europe/Berlin”. This is also used by Java. The base timezone offset is insufficient because it cannot accomodate daylight savings time and historical timezone changes.