Showing with 12 additions and 6 deletions.
  1. +12 −6 statistic.feh
@@ -365,12 +365,18 @@ namespace Statistics {

// Console.printlnErr('localDateToGMTtimestamp: ' + date);

if( d1.tm_isdst == 0 and d2.tm_isdst == 0 )
return d2.time() - 3600;
else if( d1.tm_isdst == 0 and d2.tm_isdst == 1 )
return d2.time() - 7200 - 3600;
else if( d1.tm_isdst == 1 and d2.tm_isdst == 1 )
return d2.time() - 7200;
// if( d1.tm_isdst == 0 and d2.tm_isdst == 0 )
// return d2.time() - 3600;
// else if( d1.tm_isdst == 0 and d2.tm_isdst == 1 )
// return d2.time() - 7200 - 3600;
// else if( d1.tm_isdst == 1 and d2.tm_isdst == 1 )
// return d2.time() - 7200;

// Not sure why the following works but it does
// (at least on servers in Sweden):
if( (d1.tm_isdst == 0 and d2.tm_isdst == 1) or (d1.tm_isdst == 1 and d2.tm_isdst == 0) ) // XOR
return d2.time() + 3600;

return d2.time();
}