From 04854f43614aa43c86761b8d3ce0afa4b4534ed7 Mon Sep 17 00:00:00 2001 From: vivek-kumar-2024 Date: Sun, 8 Jun 2025 16:28:28 -0700 Subject: [PATCH] Create InterceptorClock.java --- InterceptorClock.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 InterceptorClock.java diff --git a/InterceptorClock.java b/InterceptorClock.java new file mode 100644 index 0000000..55116e2 --- /dev/null +++ b/InterceptorClock.java @@ -0,0 +1,19 @@ +public class InterceptorClock { + public static void main(String[] args) { + trackTime(3600000); // 100 hours * 60 mins * 60 secs * 10 tenths + } + + public static void trackTime(int iterations) { + int tenthsOfSeconds = 0; + double timeSeconds = 0.0; + for (int i = 0; i < iterations; i++) { + tenthsOfSeconds++; + timeSeconds += 0.1; + } + double expected = tenthsOfSeconds * 0.1; + double difference = timeSeconds - expected; + System.out.println("Accumulated time: " + timeSeconds); + System.out.println("Expected time: " + expected); + System.out.println("Difference: " + difference); + } +}