The firmware for the clock is written in C using Eclipse C/C++ with the AVR Eclipse plugin with avr-gcc and avr-libc 1.8.1
Since the GPS module provides the time in UTC, I need to handle time zone and DST in software. This is actually quite easy since the standard time.h functionality has been implemented in avr-libc 1.8.1. But as I started the development on Linux using 1.8.0 it took me a while to discover the newer avr-libc since there are still no official binary packages for avr-libc 1.8.1 even though it was released more than a year ago.
After moving to OS X it was quite easy to get avr-libc 1.8.1 with macports.
In version 1.8.1 it is simple to initialize the time routines:
// time zone hardcoded to UTC+1
set_zone(1 * ONE_HOUR);
// enable european DST
set_dst(eu_dst);
Yeah, it's pretty lazy to hardcode the time zone when I have a full blown GPS receiver available, but the ATmega162 only has 16 KB flash and 1 KB RAM, I opted not to implement GPS coordinate to time zone conversion to save the limited resources for other features.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.