@@ -452,6 +452,20 @@ public:
452452 ts.tv_nsec / 100 +
453453 hnsecsToUnixEpoch;
454454 }
455+ else version(NetBSD)
456+ {
457+ static if(clockType == ClockType.second)
458+ return unixTimeToStdTime(core.stdc.time.time(null));
459+ else
460+ {
461+ timeval tv;
462+ if(gettimeofday(&tv, null) != 0)
463+ throw new TimeException("Call to gettimeofday() failed");
464+ return convert!("seconds", "hnsecs")(tv.tv_sec) +
465+ convert!("usecs", "hnsecs")(tv.tv_usec) +
466+ hnsecsToUnixEpoch;
467+ }
468+ }
455469 else version(Solaris)
456470 {
457471 static if(clockType == ClockType.second)
@@ -27049,6 +27063,7 @@ public:
2704927063 version(Posix)
2705027064 {
2705127065 version(FreeBSD) enum utcZone = "Etc/UTC";
27066+ else version(NetBSD) enum utcZone = "UTC";
2705227067 else version(linux) enum utcZone = "UTC";
2705327068 else version(OSX) enum utcZone = "UTC";
2705427069 else static assert(0, "The location of the UTC timezone file on this Posix platform must be set.");
@@ -27488,6 +27503,10 @@ public:
2748827503 // A bug on FreeBSD 9+ makes it so that this test fails.
2748927504 // https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=168862
2749027505 }
27506+ else version(NetBSD)
27507+ {
27508+ // The same bug on NetBSD 7+
27509+ }
2749127510 else
2749227511 {
2749327512 setTZEnvVar("America/Los_Angeles");
@@ -28929,6 +28948,7 @@ public:
2892928948
2893028949 if(!tzName.extension().empty ||
2893128950 !tzName.startsWith(subName) ||
28951+ tzName == "leapseconds" ||
2893228952 tzName == "+VERSION")
2893328953 {
2893428954 continue;
0 commit comments