GPS module - UTC/GMT to Pacific Standard Time (pst) Conversion.

Code Novice MAC here...CODE HELP NEEDED!
Recently I inherited a gps modem salvaged from a marine plotter, so decided to try and build a gps lcd clock using an UNO and a 16X2 LED display and TinyGPS library. The project idea code is from TinyGPS | Arduiniana

Everything went together fine with code converting the UTC time to Pacific Standard Time (PST), and Pacific Daylight Time (PDT), by subtracting 8 or 7 hours respectively from the UTC time. The LCD displayed both times correctly until UTC went between 1am to 6am where it displayed negative numbers. I tried adding 24 to the UTC which corrected the low numbers, but caused all others to be too large. It looks like I need some extra conversion help. See photos and sketch attached.

Does anyone have or know code which would solve my problem?
Thanks,
Mac

TinyGPS_CLOCK_TEST1.ino (3.32 KB)

Display_OK.png

Display_Bad1.png

Display_Bad2.png

I use (a variant of) this library for converting between UTC and the local time zone , including daylight saving time adjustment.

Hi 6v6gt,
More complicated than I thought....
Looks like I have a lot more studying to do!
Thanks,
Mac
VE7DEP

PS: I remember working on 6V6GT tube equipment

You do not need any library to implement time zones. The native AVR GCC time.h supports time zone offsets and also supports daylight savings time.

There is not a lot more to it beyond this:

#include <time.h>
#include <locale.h>
#include <util/usa_dst.h> https://www.nongnu.org/avr-libc/user-manual/usa__dst_8h_source.html
...
  set_dst(usa_dst);
  set_zone(-5 * ONE_HOUR);
...
      tm = localtime(&timer);  //this gets the local time

for my location

Thanks everyone for all the advice. I decided to just add a switch for DST.
Mac