heikkilevanto / beertracker

Simple script to track the beers I drink
GNU General Public License v2.0
2 stars 1 forks source link

Reimplement time zones #323

Open heikkilevanto opened 1 month ago

heikkilevanto commented 1 month ago

The old code when reading the file was:

   if ( hasfield($rec->{type},"mak") &&
         $rec->{mak}  =~ /^tz *, *([^ ]*) *$/i ) { # New time zone (optional spaces)
      $tz = $1;  # TODO - tz lines
      if (!$tz || $tz eq "X") {
        $ENV{"TZ"} = "/etc/localtime";  # clear it
      } else {
        foreach my $zonedir ( "/usr/share/zoneinfo", "/usr/share/zoneinfo/Europe",
          "/usr/share/zoneinfo/US") {
          my $zonefile = "$zonedir/$tz";
          if ( -f $zonefile ) {
            $ENV{"TZ"} = $zonefile;
            #print STDERR "TZ '$tz' \n";
            last;
          }
        }
      }
      next;
    } # tz

Add a Tz line type, modify this to work with it, and a way to enter such lines, possibly via the about page, or a special ops page

heikkilevanto commented 1 month ago

See also #133