fix bugs, change day_of_week formated

This commit is contained in:
Marko Oldenburg 2019-01-14 18:16:39 +01:00
parent 8e90cdb3c4
commit 6499d7f858
3 changed files with 26 additions and 74 deletions

View File

@ -208,7 +208,7 @@ sub _ProcessingRetrieveData($$) {
# print Dumper $data; ## für Debugging
$self->{cached}->{current_date_time} =
strftime( "%a, %e %b %Y %H:%M %p",
strftime( "%a, %e %b %Y %H:%M",
localtime( $self->{fetchTime} ) );
$self->{cached}->{timezone} = $data->{timezone};
$self->{cached}->{license}{text} =
@ -247,7 +247,7 @@ sub _ProcessingRetrieveData($$) {
'code' => $codes{ $data->{currently}->{icon} },
'iconAPI' => $data->{currently}->{icon},
'pubDate' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime( $data->{currently}->{'time'} )
),
'precipProbability' => $data->{currently}->{precipProbability},
@ -271,7 +271,7 @@ sub _ProcessingRetrieveData($$) {
@{ $self->{cached}->{forecast}->{daily} },
{
'pubDate' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]->{'time'}
)
@ -292,37 +292,13 @@ sub _ProcessingRetrieveData($$) {
$data->{daily}->{data}->[$i]
->{temperatureHigh} ) + 0.5
),
'tempMin' => int(
sprintf( "%.1f",
$data->{daily}->{data}->[$i]
->{temperatureMin} ) + 0.5
),
'tempMinTime' => strftime(
"%a, %e %b %Y %H:%M %p",
localtime(
$data->{daily}->{data}->[$i]
->{temperatureMinTime}
)
),
'tempMax' => int(
sprintf( "%.1f",
$data->{daily}->{data}->[$i]
->{temperatureMax} ) + 0.5
),
'tempMaxTime' => strftime(
"%a, %e %b %Y %H:%M %p",
localtime(
$data->{daily}->{data}->[$i]
->{temperatureMaxTime}
)
),
'tempLow' => int(
sprintf( "%.1f",
$data->{daily}->{data}->[$i]
->{temperatureLow} ) + 0.5
),
'tempLowTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]
->{temperatureLowTime}
@ -334,7 +310,7 @@ sub _ProcessingRetrieveData($$) {
->{temperatureHigh} ) + 0.5
),
'tempHighTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]
->{temperatureHighTime}
@ -346,7 +322,7 @@ sub _ProcessingRetrieveData($$) {
->{apparentTemperatureLow} ) + 0.5
),
'apparentTempLowTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]
->{apparentTemperatureLowTime}
@ -358,36 +334,12 @@ sub _ProcessingRetrieveData($$) {
->{apparentTemperatureHigh} ) + 0.5
),
'apparentTempHighTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]
->{apparentTemperatureHighTime}
)
),
'apparenttempMin' => int(
sprintf( "%.1f",
$data->{daily}->{data}->[$i]
->{apparentTemperatureMin} ) + 0.5
),
'apparenttempMinTime' => strftime(
"%a, %e %b %Y %H:%M %p",
localtime(
$data->{daily}->{data}->[$i]
->{apparentTemperatureMinTime}
)
),
'apparenttempMax' => int(
sprintf( "%.1f",
$data->{daily}->{data}->[$i]
->{apparentTemperatureMax} ) + 0.5
),
'apparenttempMaxTime' => strftime(
"%a, %e %b %Y %H:%M %p",
localtime(
$data->{daily}->{data}->[$i]
->{apparentTemperatureMaxTime}
)
),
'code' =>
$codes{ $data->{daily}->{data}->[$i]->{icon} },
'iconAPI' => $data->{daily}->{data}->[$i]->{icon},
@ -398,7 +350,7 @@ sub _ProcessingRetrieveData($$) {
'uvIndex' =>
$data->{daily}->{data}->[$i]->{uvIndex},
'uvIndexTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]->{uvIndexTime}
)
@ -409,7 +361,7 @@ sub _ProcessingRetrieveData($$) {
$data->{daily}->{data}->[$i]
->{precipIntensityMax},
'precipIntensityMaxTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]
->{precipIntensityMaxTime}
@ -445,7 +397,7 @@ sub _ProcessingRetrieveData($$) {
+ 0.5
),
'windGustTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]->{windGustTime}
)
@ -453,13 +405,13 @@ sub _ProcessingRetrieveData($$) {
'moonPhase' =>
$data->{daily}->{data}->[$i]->{moonPhase},
'sunsetTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]->{sunsetTime}
)
),
'sunriseTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{daily}->{data}->[$i]->{sunriseTime}
)
@ -495,13 +447,13 @@ sub _ProcessingRetrieveData($$) {
@{ $self->{cached}->{forecast}->{hourly} },
{
'pubDate' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
$data->{hourly}->{data}->[$i]->{'time'}
)
),
'day_of_week' => strftime(
"%a",
"%a, %H:%M",
localtime(
$data->{hourly}->{data}->[$i]->{'time'}
)
@ -576,7 +528,7 @@ sub _ErrorHandling($$) {
my ( $self, $err ) = @_;
$self->{cached}->{current_date_time} =
strftime( "%a, %e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ),
strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ),
$self->{cached}->{status} = $err;
$self->{cached}->{validity} = 'stale';
}

View File

@ -262,7 +262,7 @@ sub _ProcessingRetrieveData($$) {
###### Ab hier wird die ResponseHash Referenze für die Rückgabe zusammen gestellt
$self->{cached}->{current_date_time} =
strftime( "%a, %e %b %Y %H:%M %p",
strftime( "%a, %e %b %Y %H:%M",
localtime( $self->{fetchTime} ) );
if ( $self->{endpoint} eq 'weather' ) {
@ -310,15 +310,15 @@ sub _ProcessingRetrieveData($$) {
'code' => $codes{ $data->{weather}->[0]->{id} },
'iconAPI' => $data->{weather}->[0]->{icon},
'sunsetTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime( $data->{sys}->{sunset} )
),
'sunriseTime' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime( $data->{sys}->{sunrise} )
),
'pubDate' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime( $data->{dt} )
),
};
@ -337,13 +337,13 @@ sub _ProcessingRetrieveData($$) {
@{ $self->{cached}->{forecast}->{hourly} },
{
'pubDate' => strftime(
"%a, %e %b %Y %H:%M %p",
"%a, %e %b %Y %H:%M",
localtime(
( $data->{list}->[$i]->{dt} ) - 3600
)
),
'day_of_week' => strftime(
"%a",
"%a, %H:%M",
localtime(
( $data->{list}->[$i]->{dt} ) - 3600
)
@ -462,7 +462,7 @@ sub _ErrorHandling($$) {
my ( $self, $err ) = @_;
$self->{cached}->{current_date_time} =
strftime( "%a, %e %b %Y %H:%M %p", localtime( $self->{fetchTime} ) ),
strftime( "%a, %e %b %Y %H:%M", localtime( $self->{fetchTime} ) ),
$self->{cached}->{status} = $err;
$self->{cached}->{validity} = 'stale';
}