File tree 1 file changed +27
-10
lines changed
1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change 60
60
my $changing = 0; my $lastdata ;
61
61
foreach my $d ( @{$data } )
62
62
{
63
- # Don't use unixtime parameter, as it depends on
64
- # timezone of PC, not datalogger
65
- my $dt = DateTime-> new(
66
- year => $d -> {year },
67
- month => $d -> {month },
68
- day => $d -> {day },
69
- hour => $d -> {hour },
70
- minute => $d -> {min },
71
- time_zone => $timezone ,
72
- );
63
+ my $dt ;
64
+ # Make up for retarded weather station that produces
65
+ # invalid times
66
+ try {
67
+ # Don't use unixtime parameter, as it depends on
68
+ # timezone of PC, not datalogger
69
+ $dt = DateTime-> new(
70
+ year => $d -> {year },
71
+ month => $d -> {month },
72
+ day => $d -> {day },
73
+ hour => $d -> {hour },
74
+ minute => $d -> {min },
75
+ time_zone => $timezone ,
76
+ );
77
+ } catch {
78
+ # Possible invalid time, because logger forwards
79
+ # its clocks one hour too late (for GMT/BST at least).
80
+ # Attempt again, with time one hour forward.
81
+ $dt = DateTime-> new(
82
+ year => $d -> {year },
83
+ month => $d -> {month },
84
+ day => $d -> {day },
85
+ hour => $d -> {hour } + 1,
86
+ minute => $d -> {min },
87
+ time_zone => $timezone ,
88
+ );
89
+ };
73
90
74
91
# Monitor for a DST "ambiguous" time, when the clocks change.
75
92
# For an hour when the clocks go back, the winter time minus
You can’t perform that action at this time.
0 commit comments