Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/stable' into merge_stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Jul 20, 2016
2 parents 0241a40 + 01eb06b commit 7f61127
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
39 changes: 23 additions & 16 deletions std/datetime.d
Expand Up @@ -122,6 +122,12 @@ version(Windows)
import core.sys.windows.windows;
import core.sys.windows.winsock2;
import std.windows.registry;

// Uncomment and run unittests to print missing Windows TZ translations.
// Please subscribe to Microsoft Daylight Saving Time & Time Zone Blog
// (https://blogs.technet.microsoft.com/dst2007/) if you feel responsible
// for updating the translations.
// version = UpdateWindowsTZTranslations;
}
else version(Posix)
{
Expand Down Expand Up @@ -28160,21 +28166,14 @@ public:
{
import std.algorithm : startsWith, sort;
import std.array : appender;
import std.format : format;

auto windowsNames = WindowsTimeZone.getInstalledTZNames();
auto retval = appender!(string[])();

foreach (winName; windowsNames)
{
auto tzName = windowsTZNameToTZDatabaseName(winName);

version(unittest)
{
assert(tzName !is null, format("TZName which is missing: %s", winName));
}

if (tzName !is null && tzName.startsWith(subName))
if(tzName !is null && tzName.startsWith(subName))
retval.put(tzName);
}

Expand Down Expand Up @@ -31582,11 +31581,15 @@ string tzDatabaseNameToWindowsTZName(string tzName) @safe pure nothrow @nogc
}
}

version(Windows) deprecated @system unittest
version(Windows) version(UpdateWindowsTZTranslations) deprecated @system unittest
{
import std.format : format;
foreach (tzName; TimeZone.getInstalledTZNames())
assert(tzDatabaseNameToWindowsTZName(tzName) !is null, format("TZName which failed: %s", tzName));
import std.stdio : stderr;

foreach(tzName; TimeZone.getInstalledTZNames())
{
if (tzDatabaseNameToWindowsTZName(tzName) is null)
stderr.writeln("Missing TZName to Windows translation: ", tzName);
}
}


Expand Down Expand Up @@ -31758,11 +31761,15 @@ string windowsTZNameToTZDatabaseName(string tzName) @safe pure nothrow @nogc
}
}

version(Windows) deprecated @system unittest
version(Windows) version(UpdateWindowsTZTranslations) deprecated @system unittest
{
import std.format : format;
foreach (tzName; WindowsTimeZone.getInstalledTZNames())
assert(windowsTZNameToTZDatabaseName(tzName) !is null, format("TZName which failed: %s", tzName));
import std.stdio : stderr;

foreach(winName; WindowsTimeZone.getInstalledTZNames())
{
if (windowsTZNameToTZDatabaseName(winName) is null)
stderr.writeln("Missing Windows to TZName translation: ", winName);
}
}


Expand Down
22 changes: 20 additions & 2 deletions std/stdio.d
Expand Up @@ -4236,6 +4236,10 @@ extern(C) void std_stdio_static_this()
__gshared
{
/** The standard input stream.
Bugs:
Due to $(WEB https://issues.dlang.org/show_bug.cgi?id=15768, bug 15768),
it is thread un-safe to reassign `stdin` to a different `File` instance
than the default.
*/
File stdin;
///
Expand All @@ -4254,8 +4258,22 @@ __gshared
}
}

File stdout; /// The standard output stream.
File stderr; /// The standard error stream.
/**
The standard output stream.
Bugs:
Due to $(WEB https://issues.dlang.org/show_bug.cgi?id=15768, bug 15768),
it is thread un-safe to reassign `stdout` to a different `File` instance
than the default.
*/
File stdout;
/**
The standard error stream.
Bugs:
Due to $(WEB https://issues.dlang.org/show_bug.cgi?id=15768, bug 15768),
it is thread un-safe to reassign `stderr` to a different `File` instance
than the default.
*/
File stderr;
}

@system unittest
Expand Down

0 comments on commit 7f61127

Please sign in to comment.