diff options
author | Abyss777 <abyss@fox5.ru> | 2017-03-13 17:52:28 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-03-13 17:52:28 +0500 |
commit | 2309d53f52f25efe00f2195a58c448506a2605ab (patch) | |
tree | 9fdddd2384e4e331c1642f919d3db4fb1621cccb /src/org/traccar/reports/ReportUtils.java | |
parent | 633bed5cd14c16d53c7b84ed2c6586915467e1a8 (diff) | |
download | trackermap-server-2309d53f52f25efe00f2195a58c448506a2605ab.tar.gz trackermap-server-2309d53f52f25efe00f2195a58c448506a2605ab.tar.bz2 trackermap-server-2309d53f52f25efe00f2195a58c448506a2605ab.zip |
- Add timezone field to User and Server model
- Pass Velocity DateTool to templates
- Adjusted templates to use timezone
Diffstat (limited to 'src/org/traccar/reports/ReportUtils.java')
-rw-r--r-- | src/org/traccar/reports/ReportUtils.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 1402e10d4..968fb357b 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -24,6 +24,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Collection; +import java.util.TimeZone; public final class ReportUtils { @@ -46,6 +47,14 @@ public final class ReportUtils { return unit != null ? unit : "kn"; } + public static TimeZone getTimezone(long userId) { + String timezone = Context.getPermissionsManager().getUser(userId).getTimezone(); + if (timezone == null) { + timezone = Context.getPermissionsManager().getServer().getTimezone(); + } + return timezone != null ? TimeZone.getTimeZone(timezone) : TimeZone.getDefault(); + } + public static Collection<Long> getDeviceList(Collection<Long> deviceIds, Collection<Long> groupIds) { Collection<Long> result = new ArrayList<>(); result.addAll(deviceIds); |