mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 01:09:47 +01:00
Fix getLast24Hours() -- take end time into account
This commit is contained in:
parent
a6d18e599b
commit
d791054e42
@ -273,20 +273,19 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
||||
*/
|
||||
protected List<ActivitySample> getAllSamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
|
||||
if (tsFrom == -1) {
|
||||
tsFrom = getTSLast24Hours();
|
||||
tsFrom = getTSLast24Hours(tsTo);
|
||||
}
|
||||
SampleProvider provider = getProvider(device);
|
||||
return db.getAllActivitySamples(tsFrom, tsTo, provider);
|
||||
}
|
||||
|
||||
private int getTSLast24Hours() {
|
||||
long now = System.currentTimeMillis();
|
||||
return (int) ((now / 1000) - (24 * 60 * 60)); // -24 hours
|
||||
private int getTSLast24Hours(int tsTo) {
|
||||
return (tsTo) - (24 * 60 * 60); // -24 hours
|
||||
}
|
||||
|
||||
protected List<ActivitySample> getActivitySamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
|
||||
if (tsFrom == -1) {
|
||||
tsFrom = getTSLast24Hours();
|
||||
tsFrom = getTSLast24Hours(tsTo);
|
||||
}
|
||||
SampleProvider provider = getProvider(device);
|
||||
return db.getActivitySamples(tsFrom, tsTo, provider);
|
||||
@ -295,7 +294,7 @@ public abstract class AbstractChartFragment extends AbstractGBFragment {
|
||||
|
||||
protected List<ActivitySample> getSleepSamples(DBHandler db, GBDevice device, int tsFrom, int tsTo) {
|
||||
if (tsFrom == -1) {
|
||||
tsFrom = getTSLast24Hours();
|
||||
tsFrom = getTSLast24Hours(tsTo);
|
||||
}
|
||||
SampleProvider provider = getProvider(device);
|
||||
return db.getSleepSamples(tsFrom, tsTo, provider);
|
||||
|
Loading…
Reference in New Issue
Block a user