Changing Time Zone for Kafka

Hi, All.
Who knows how Kafka will behave when changing time zones? We are soon switching from UTC +6 to UTC +5. Will simply changing the settings in NTP or Chrony resolve this issue? Perhaps someone has practical experience dealing with this?

I can’t think of any issues that you’ll need to worry about since Kafka generally deals in Unix epoch timestamps. As long as the system time is correct, then timestamps in headers and operations that rely on time like log cleaning will “just work”.

What specifically is switching time zones? Brokers? Clients? And what mechanism? Literally shut down servers in one time zone and boot up in another? Any time-based aggregations or other application-level issues that you need to worry about? What format are the timestamps in logs and do you need to tweak any log4j config (unlikely)?

I’d recommend a little sanity check program in the new time zone to make sure it’s done properly. Copy this into PrintTime.java and run javac PrintTime.java && java PrintTime and make sure the output looks right (e.g., compare to epochconverter.com):

import java.time.Instant;


public class PrintTime {
    public static void main(final String[] args) {
        System.out.println("System.currentTimeMillis():   " + System.currentTimeMillis());
        System.out.println("Instant.now().toEpochMilli(): " + Instant.now().toEpochMilli());
    }
}

Hi @dtroiano. Thank you for your response. This is not the usual annual time zone change, but an entire part of the country changing time from UTC +6 to +5. Brokers, clients all system will change time zone. Producers write to the topic in local time UTC +6. Timestamps in log in local format.