#include <RTClib.h>
RTC_DS1307 rtc;
int h, m, s = 0;
DateTime current;
void setup() {
Serial.begin(9600);
if (!rtc.begin()) {
Serial.println("RTC Not Initialised");
while(true);
}
}
void loop() {
current = rtc.now();
h = current.hour();
m = current.minute();
s = current.second();
inTime();
usTime();
frTime();
Serial.println("*******");
delay(1000);
}
void inTime() {
String time = "IN Time:- " + String(h) + ":" + String(m) + ":" + String(s);
Serial.println(time);
}
void usTime() {
int usH = h-11;
int usM = m-30;
if (usH < 0) usH = 24 + usH;
if (usM < 0) usM = 60 + usM;
String time = "US Time:- " + String(usH) + ":" + String(usM) + ":" + String(s);
Serial.println(time);
}
void frTime() {
int frH = h-30;
int frM = m-30;
if (frH < 0) frH = 24 + frH;
if (frM < 0) frM = 60 + frM;
String time = "FR Time:- " + String(frH) + ":" + String(frM) + ":" + String(s);
Serial.println(time);
}