summaryrefslogtreecommitdiff
path: root/app/php/dto/TimezoneDTO.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-03-16 22:57:29 +0100
committeremkael <emkael@tlen.pl>2016-03-16 22:57:29 +0100
commit89e2c7d7f9a9e2889770409c7d2be668c06af87d (patch)
tree0f8179e1bdd00d486c3890e40dce529c6f6f39f6 /app/php/dto/TimezoneDTO.php
parent51c2c559ecf853583b44145a9e06799c434d5c59 (diff)
* TimezoneDTO comparator
Diffstat (limited to 'app/php/dto/TimezoneDTO.php')
-rw-r--r--app/php/dto/TimezoneDTO.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/php/dto/TimezoneDTO.php b/app/php/dto/TimezoneDTO.php
index 4bb57f2..d80d4dd 100644
--- a/app/php/dto/TimezoneDTO.php
+++ b/app/php/dto/TimezoneDTO.php
@@ -17,6 +17,11 @@ class TimezoneDTO {
$this->Label = sprintf('UTC%+03d:%02d %s', $this->OffsetHours, $this->OffsetMinutes, $this->Name);
}
+ public static function __compare(TimezoneDTO $tz1, TimezoneDTO $tz2) {
+ $diff = $tz1->Offset - $tz2->Offset;
+ return ($diff == 0) ? strcmp($tz1->Name, $tz2->Name) : $diff;
+ }
+
}
?>