I've got several, general problems I'm trying to solve before I try to start tackling the details. I was hoping for some suggestions before I commit to a bad solution, early.
I am using jchristensen's TimeZone library.
The user will need to be able to select their local time zone from a list that will scroll on a 16x2 LCD using up down keys.
My first attempt was to create an array of timezones, but that wouldn't compile.
#include <Timezone.h> //https://github.com/JChristensen/Timezone
//Australia Eastern Time Zone (Sydney, Melbourne)
TimeChangeRule aEDT = {"AEDT", First, Sun, Oct, 2, 660}; //UTC + 11 hours
TimeChangeRule aEST = {"AEST", First, Sun, Apr, 3, 600}; //UTC + 10 hours
Timezone ausQLD(aEST, aEST);
Timezone ausNSW(aEDT, aEST);
//Australia Central Time Zone (Darwin)
TimeChangeRule aCDT = {"ACDT", First, Sun, Oct, 2, 630}; //UTC + 10.5 hours
TimeChangeRule aCST = {"ACST", First, Sun, Apr, 3, 570}; //UTC + 9.5 hours
Timezone ausNT(aCST, aCST);
Timezone ausSA(aCDT, aCST);
//Australia Western Time Zone (Perth)
TimeChangeRule aWST = {"AWST", First, Sun, Apr, 3, 480}; //UTC + 8 hours
Timezone ausWA(aWST, aWST);
#define NUMBER_OF_TIME_ZONES 5
Timezone timeZones_arr[NUMBER_OF_TIME_ZONES] = {
ausQLD(aEST, aEST),
ausNSW(aEDT, aEST),
ausNT(aCST, aCST),
ausSA(aCDT, aCST),
ausWA(aWST, aWST)
}
My second approach is to define an array of strings that will hold user friendly names of the timezones. The index of the array will be somehow tied to the list of timezones. But, now that I think of it, would a does it make more sense to create a typedef with a string and timezone? My problem is being able to know what timezone is selected by the user and reference that in code later.
Can anyone give me an idea a good way to do this within the scope of the timezone library?
Thanks,
John
... off to experiment with the typedef option.