blob: 86d7859a6f7a603840e8f3c3954f722522461677 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
/**
* Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/
namespace Icewind\SMB;
class TimeZoneProvider {
/**
* @var string
*/
private $host;
/**
* @var string
*/
private $timeZone;
/**
* @var System
*/
private $system;
/**
* @param string $host
* @param System $system
*/
function __construct($host, System $system) {
$this->host = $host;
$this->system = $system;
}
public function get() {
if (!$this->timeZone) {
$net = $this->system->getNetPath();
if ($net) {
$command = sprintf('%s time zone -S %s',
$net,
escapeshellarg($this->host)
);
$this->timeZone = exec($command);
} else { // fallback to server timezone
$this->timeZone = date_default_timezone_get();
}
}
return $this->timeZone;
}
}
|