Skip to content

Commit

Permalink
Two more imports eliminated
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Dec 19, 2017
1 parent 385836b commit 57dcc71
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions std/datetime/timezone.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ version(Windows)
// for updating the translations.
// version = UpdateWindowsTZTranslations;
}
else version(Posix)
{
import core.sys.posix.signal : timespec;
import core.sys.posix.sys.types : time_t;
}

version(unittest) import std.exception : assertThrown;

Expand Down Expand Up @@ -257,7 +252,7 @@ public:
static void testTM(in SysTime st)
{
import core.stdc.time : localtime, tm;
time_t unixTime = st.toUnixTime();
auto unixTime = st.toUnixTime();
tm* osTimeInfo = localtime(&unixTime);
tm ourTimeInfo = st.toTM();

Expand Down Expand Up @@ -852,7 +847,7 @@ public:
{
import core.stdc.time : localtime, tm;
import std.datetime.systime : stdTimeToUnixTime;
time_t unixTime = stdTimeToUnixTime(stdTime);
auto unixTime = stdTimeToUnixTime(stdTime);

version(Posix)
{
Expand Down Expand Up @@ -906,7 +901,7 @@ public:
{
import core.stdc.time : localtime, tm;
import std.datetime.systime : stdTimeToUnixTime;
time_t unixTime = stdTimeToUnixTime(stdTime);
auto unixTime = stdTimeToUnixTime(stdTime);
tm* timeInfo = localtime(&unixTime);

return stdTime + convert!("seconds", "hnsecs")(timeInfo.tm_gmtoff);
Expand Down Expand Up @@ -943,8 +938,9 @@ public:
version(Posix)
{
import core.stdc.time : localtime, tm;
import core.sys.posix.sys.types : time_t;
import std.datetime.systime : stdTimeToUnixTime;
time_t unixTime = stdTimeToUnixTime(adjTime);
auto unixTime = stdTimeToUnixTime(adjTime);

immutable past = unixTime - cast(time_t) convert!("days", "seconds")(1);
tm* timeInfo = localtime(past < unixTime ? &past : &unixTime);
Expand Down Expand Up @@ -1151,7 +1147,7 @@ private:
import core.stdc.time : localtime, gmtime, tm;
import std.datetime.systime : stdTimeToUnixTime;

time_t unixTime = stdTimeToUnixTime(stdTime);
auto unixTime = stdTimeToUnixTime(stdTime);
tm* buf = localtime(&unixTime);
tm timeInfo = *buf;
buf = gmtime(&unixTime);
Expand Down Expand Up @@ -1978,7 +1974,7 @@ public:

immutable leapSecs = calculateLeapSeconds(adjTime);
import std.datetime.systime : stdTimeToUnixTime;
time_t unixTime = stdTimeToUnixTime(adjTime);
auto unixTime = stdTimeToUnixTime(adjTime);
immutable past = unixTime - convert!("days", "seconds")(1);
immutable future = unixTime + convert!("days", "seconds")(1);

Expand Down

0 comments on commit 57dcc71

Please sign in to comment.