1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

store UTC in weather timestamp

This commit is contained in:
Andreas Shimokawa 2017-08-22 00:26:49 +02:00
parent 4c8728c78f
commit b9eedce13b

View File

@ -23,6 +23,8 @@ import android.content.Intent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.SimpleTimeZone;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.model.Weather; import nodomain.freeyourgadget.gadgetbridge.model.Weather;
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec; import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
@ -51,7 +53,7 @@ public class WeatherNotificationReceiver extends BroadcastReceiver {
LOG.info("weather in " + weather.location + " is " + weather.currentCondition + " (" + (weather.currentTemp - 273) + "°C)"); LOG.info("weather in " + weather.location + " is " + weather.currentCondition + " (" + (weather.currentTemp - 273) + "°C)");
WeatherSpec weatherSpec = new WeatherSpec(); WeatherSpec weatherSpec = new WeatherSpec();
weatherSpec.timestamp = (int) (weather.queryTime / 1000); weatherSpec.timestamp = (int) ((weather.queryTime - SimpleTimeZone.getDefault().getOffset(weather.queryTime)) / 1000);
weatherSpec.location = weather.location; weatherSpec.location = weather.location;
weatherSpec.currentTemp = weather.currentTemp; weatherSpec.currentTemp = weather.currentTemp;
weatherSpec.currentCondition = weather.currentCondition; weatherSpec.currentCondition = weather.currentCondition;