aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/datetime
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-10 03:14:20 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-10 05:25:41 +0100
commit9c7d5e8846edb28e5421211ee8eaad93e234de2c (patch)
tree36b78f03305b82ef82ec5ecfaf29844fadd86ddc /libphobos/src/std/datetime
parent38c60e5075f89265a560eab166d43247624a7535 (diff)
downloadgcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.zip
gcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.tar.gz
gcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.tar.bz2
d: Merge upstream dmd 3982604c5, druntime bc58b1e9, phobos 12329adb6.
D front-end changes: - Import dmd mainline development. - Split off enum EXP from enum TOK. - Integer promotions now follow C integral promotions by default. - Implements __traits(initSymbol). - Lowering of array construction has been moved to the dmd front-end. - Fix segfault in dmd.lexer from unaligned read (PR103529). Druntime changes: - Import druntime mainline development. - Define SIG_BLOCK for Solaris (PR103528). Phobos changes: - Import phobos mainline development. gcc/d/ChangeLog: PR d/103529 * dmd/MERGE: Merge upstream dmd 3982604c5. * Make-lang.in (D_FRONTEND_OBJS): Add d/root-optional.o. * d-attribs.cc (build_attributes): Update for new front-end interface. * d-codegen.cc (d_build_call): Likewise. * d-compiler.cc (Compiler::paintAsType): Likewise. * d-lang.cc (d_handle_option): Remove OPT_fpreview_intpromote, add handling of OPT_frevert_intpromote. * d-port.cc (Port::valcpy): Assert buffer is aligned. * d-target.cc (Target::isVectorOpSupported): Update for new front-end interface. * decl.cc (layout_class_initializer): Likewise. * expr.cc (lvalue_p): Likewise. (binop_assignment): Likewise. (ExprVisitor::visit): Likewise. (ExprVisitor::visit (AssignExp *)): Remove generation of _d_arrayctor and _d_arraysetctor library helpers. (ExprVisitor::visit (VarExp *)): Support __traits(initSymbol). * intrinsics.cc (expand_intrinsic_rotate): Update for new front-end interface. * lang.opt (fpreview=intpromote): Remove. (frevert=intpromote): New. * runtime.def (ARRAYCTOR): Remove. (ARRAYSETCTOR): Remove. * toir.cc (IRVisitor::visit): Update for new front-end interface. * types.cc (layout_aggregate_members): Likewise. * dmd/root/optional.d: New file. * dmd/root/optional.h: New file. libphobos/ChangeLog: PR d/103528 * libdruntime/MERGE: Merge upstream druntime bc58b1e9. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Remove core/sys/linux/syscalls.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 12329adb6. * testsuite/libphobos.config/config.exp: Add test22523. * libdruntime/core/sys/linux/syscalls.d: Removed. * testsuite/libphobos.config/test22523.d: New test.
Diffstat (limited to 'libphobos/src/std/datetime')
-rw-r--r--libphobos/src/std/datetime/interval.d6
-rw-r--r--libphobos/src/std/datetime/systime.d27
-rw-r--r--libphobos/src/std/datetime/timezone.d74
3 files changed, 54 insertions, 53 deletions
diff --git a/libphobos/src/std/datetime/interval.d b/libphobos/src/std/datetime/interval.d
index 741088a..ba2a210 100644
--- a/libphobos/src/std/datetime/interval.d
+++ b/libphobos/src/std/datetime/interval.d
@@ -8349,7 +8349,7 @@ private:
}
{
- SysTime stFunc(scope const SysTime st) { return cast(SysTime) st; }
+ SysTime stFunc(scope const SysTime st) { return SysTime.init; }
auto interval = Interval!SysTime(SysTime(DateTime(2010, 7, 4, 12, 1, 7)),
SysTime(DateTime(2012, 1, 7, 14, 0, 0)));
auto ir = IntervalRange!(SysTime, Direction.fwd)(interval, &stFunc);
@@ -8794,7 +8794,7 @@ private:
}
{
- SysTime stFunc(scope const SysTime st) { return cast(SysTime) st; }
+ SysTime stFunc(scope const SysTime st) { return SysTime.init; }
auto posInfInterval = PosInfInterval!SysTime(SysTime(DateTime(2010, 7, 4, 12, 1, 7)));
auto ir = PosInfIntervalRange!SysTime(posInfInterval, &stFunc);
}
@@ -9076,7 +9076,7 @@ private:
}
{
- SysTime stFunc(scope const SysTime st) { return cast(SysTime)(st); }
+ SysTime stFunc(scope const SysTime st) { return SysTime.init; }
auto negInfInterval = NegInfInterval!SysTime(SysTime(DateTime(2012, 1, 7, 14, 0, 0)));
auto ir = NegInfIntervalRange!(SysTime)(negInfInterval, &stFunc);
}
diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d
index 4da1281..9b2a844 100644
--- a/libphobos/src/std/datetime/systime.d
+++ b/libphobos/src/std/datetime/systime.d
@@ -503,7 +503,7 @@ public:
given $(REF DateTime,std,datetime,date) is assumed to
be in the given time zone.
+/
- this(DateTime dateTime, immutable TimeZone tz = null) @safe nothrow
+ this(DateTime dateTime, return scope immutable TimeZone tz = null) return scope @safe nothrow
{
try
this(dateTime, Duration.zero, tz);
@@ -554,7 +554,7 @@ public:
$(REF DateTimeException,std,datetime,date) if `fracSecs` is negative or if it's
greater than or equal to one second.
+/
- this(DateTime dateTime, Duration fracSecs, immutable TimeZone tz = null) @safe
+ this(DateTime dateTime, Duration fracSecs, return scope immutable TimeZone tz = null) return scope @safe
{
enforce(fracSecs >= Duration.zero, new DateTimeException("A SysTime cannot have negative fractional seconds."));
enforce(fracSecs < seconds(1), new DateTimeException("Fractional seconds must be less than one second."));
@@ -611,7 +611,7 @@ public:
given $(REF Date,std,datetime,date) is assumed to be in the
given time zone.
+/
- this(Date date, immutable TimeZone tz = null) @safe nothrow
+ this(Date date, return scope immutable TimeZone tz = null) return scope @safe nothrow
{
_timezone = tz is null ? LocalTime() : tz;
@@ -664,7 +664,7 @@ public:
$(LREF SysTime). If null,
$(REF LocalTime,std,datetime,timezone) will be used.
+/
- this(long stdTime, immutable TimeZone tz = null) @safe pure nothrow
+ this(long stdTime, return scope immutable TimeZone tz = null) return scope @safe pure nothrow
{
_stdTime = stdTime;
_timezone = tz is null ? LocalTime() : tz;
@@ -693,7 +693,7 @@ public:
Returns: The `this` of this `SysTime`.
+/
- ref SysTime opAssign()(auto ref const(SysTime) rhs) return @safe pure nothrow scope
+ ref SysTime opAssign()(auto ref const(SysTime) rhs) return scope @safe pure nothrow
{
_stdTime = rhs._stdTime;
_timezone = rhs._timezone;
@@ -710,6 +710,7 @@ public:
st = other;
assert(st == other);
+ version (none) // https://issues.dlang.org/show_bug.cgi?id=21175
static void testScope(scope ref SysTime left, const scope SysTime right) @safe
{
left = right;
@@ -2184,7 +2185,7 @@ public:
hours - adjust the time to this $(LREF SysTime)'s time zone before
returning.
+/
- @property immutable(TimeZone) timezone() @safe const pure nothrow scope
+ @property immutable(TimeZone) timezone() @safe const pure nothrow return scope
{
return _timezone;
}
@@ -2238,7 +2239,7 @@ public:
/++
Returns whether DST is in effect for this $(LREF SysTime).
+/
- @property bool dstInEffect() @safe const nothrow scope
+ @property bool dstInEffect() @safe const nothrow return scope
{
return _timezone.dstInEffect(_stdTime);
}
@@ -2261,7 +2262,7 @@ public:
Returns what the offset from UTC is for this $(LREF SysTime).
It includes the DST offset in effect at that time (if any).
+/
- @property Duration utcOffset() @safe const nothrow scope
+ @property Duration utcOffset() @safe const nothrow return scope
{
return _timezone.utcOffsetAt(_stdTime);
}
@@ -9586,13 +9587,13 @@ private:
@property override bool hasDST() @safe const nothrow @nogc { return false; }
- override bool dstInEffect(long stdTime) @safe const nothrow @nogc { return false; }
+ override bool dstInEffect(long stdTime) @safe const scope nothrow @nogc { return false; }
- override long utcToTZ(long stdTime) @safe const nothrow @nogc { return 0; }
+ override long utcToTZ(long stdTime) @safe const scope nothrow @nogc { return 0; }
- override long tzToUTC(long adjTime) @safe const nothrow @nogc { return 0; }
+ override long tzToUTC(long adjTime) @safe const scope nothrow @nogc { return 0; }
- override Duration utcOffsetAt(long stdTime) @safe const nothrow @nogc { return Duration.zero; }
+ override Duration utcOffsetAt(long stdTime) @safe const scope nothrow @nogc { return Duration.zero; }
private:
@@ -9628,7 +9629,7 @@ private:
return _timezoneStorage is null ? InitTimeZone() : _timezoneStorage;
}
- pragma(inline, true) @property void _timezone(immutable TimeZone tz) @safe pure nothrow @nogc scope
+ pragma(inline, true) @property void _timezone(return scope immutable TimeZone tz) @safe pure nothrow @nogc scope
{
_timezoneStorage = tz;
}
diff --git a/libphobos/src/std/datetime/timezone.d b/libphobos/src/std/datetime/timezone.d
index 0527580..a55411b 100644
--- a/libphobos/src/std/datetime/timezone.d
+++ b/libphobos/src/std/datetime/timezone.d
@@ -100,7 +100,7 @@ public:
However, on Windows, it may be the unabbreviated name (e.g. Pacific
Standard Time). Regardless, it is not the same as name.
+/
- @property string stdName() @safe const nothrow
+ @property string stdName() @safe const scope nothrow
{
return _stdName;
}
@@ -113,7 +113,7 @@ public:
However, on Windows, it may be the unabbreviated name (e.g. Pacific
Daylight Time). Regardless, it is not the same as name.
+/
- @property string dstName() @safe const nothrow
+ @property string dstName() @safe const scope nothrow
{
return _dstName;
}
@@ -137,7 +137,7 @@ public:
stdTime = The UTC time that needs to be checked for DST in this time
zone.
+/
- abstract bool dstInEffect(long stdTime) @safe const nothrow;
+ abstract bool dstInEffect(long stdTime) @safe const scope nothrow;
/++
@@ -148,7 +148,7 @@ public:
stdTime = The UTC time that needs to be adjusted to this time zone's
time.
+/
- abstract long utcToTZ(long stdTime) @safe const nothrow;
+ abstract long utcToTZ(long stdTime) @safe const scope nothrow;
/++
@@ -159,7 +159,7 @@ public:
adjTime = The time in this time zone that needs to be adjusted to
UTC time.
+/
- abstract long tzToUTC(long adjTime) @safe const nothrow;
+ abstract long tzToUTC(long adjTime) @safe const scope nothrow;
/++
@@ -170,7 +170,7 @@ public:
stdTime = The UTC time for which to get the offset from UTC for this
time zone.
+/
- Duration utcOffsetAt(long stdTime) @safe const nothrow
+ Duration utcOffsetAt(long stdTime) @safe const scope nothrow
{
return dur!"hnsecs"(utcToTZ(stdTime) - stdTime);
}
@@ -580,7 +580,7 @@ public:
dynamically rather than it being fixed like it would be with most time
zones.
+/
- @property override string stdName() @trusted const nothrow
+ @property override string stdName() @trusted const scope nothrow
{
version (Posix)
{
@@ -665,7 +665,7 @@ public:
dynamically rather than it being fixed like it would be with most time
zones.
+/
- @property override string dstName() @trusted const nothrow
+ @property override string dstName() @trusted const scope nothrow
{
version (Posix)
{
@@ -809,7 +809,7 @@ public:
stdTime = The UTC time that needs to be checked for DST in this time
zone.
+/
- override bool dstInEffect(long stdTime) @trusted const nothrow
+ override bool dstInEffect(long stdTime) @trusted const scope nothrow
{
import core.stdc.time : tm;
@@ -863,7 +863,7 @@ public:
See_Also:
`TimeZone.utcToTZ`
+/
- override long utcToTZ(long stdTime) @trusted const nothrow
+ override long utcToTZ(long stdTime) @trusted const scope nothrow
{
version (Solaris)
return stdTime + convert!("seconds", "hnsecs")(tm_gmtoff(stdTime));
@@ -904,7 +904,7 @@ public:
adjTime = The time in this time zone that needs to be adjusted to
UTC time.
+/
- override long tzToUTC(long adjTime) @trusted const nothrow
+ override long tzToUTC(long adjTime) @trusted const scope nothrow
{
version (Posix)
{
@@ -1159,7 +1159,7 @@ public:
/++
Always returns false.
+/
- override bool dstInEffect(long stdTime) @safe const nothrow
+ override bool dstInEffect(long stdTime) @safe const scope nothrow
{
return false;
}
@@ -1175,7 +1175,7 @@ public:
See_Also:
`TimeZone.utcToTZ`
+/
- override long utcToTZ(long stdTime) @safe const nothrow
+ override long utcToTZ(long stdTime) @safe const scope nothrow
{
return stdTime;
}
@@ -1208,7 +1208,7 @@ public:
adjTime = The time in this time zone that needs to be adjusted to
UTC time.
+/
- override long tzToUTC(long adjTime) @safe const nothrow
+ override long tzToUTC(long adjTime) @safe const scope nothrow
{
return adjTime;
}
@@ -1238,7 +1238,7 @@ public:
stdTime = The UTC time for which to get the offset from UTC for this
time zone.
+/
- override Duration utcOffsetAt(long stdTime) @safe const nothrow
+ override Duration utcOffsetAt(long stdTime) @safe const scope nothrow
{
return dur!"hnsecs"(0);
}
@@ -1285,7 +1285,7 @@ public:
/++
Always returns false.
+/
- override bool dstInEffect(long stdTime) @safe const nothrow
+ override bool dstInEffect(long stdTime) @safe const scope nothrow
{
return false;
}
@@ -1299,7 +1299,7 @@ public:
stdTime = The UTC time that needs to be adjusted to this time zone's
time.
+/
- override long utcToTZ(long stdTime) @safe const nothrow
+ override long utcToTZ(long stdTime) @safe const scope nothrow
{
return stdTime + _utcOffset.total!"hnsecs";
}
@@ -1326,7 +1326,7 @@ public:
adjTime = The time in this time zone that needs to be adjusted to
UTC time.
+/
- override long tzToUTC(long adjTime) @safe const nothrow
+ override long tzToUTC(long adjTime) @safe const scope nothrow
{
return adjTime - _utcOffset.total!"hnsecs";
}
@@ -1352,7 +1352,7 @@ public:
stdTime = The UTC time for which to get the offset from UTC for this
time zone.
+/
- override Duration utcOffsetAt(long stdTime) @safe const nothrow
+ override Duration utcOffsetAt(long stdTime) @safe const scope nothrow
{
return _utcOffset;
}
@@ -1919,7 +1919,7 @@ public:
stdTime = The UTC time that needs to be checked for DST in this time
zone.
+/
- override bool dstInEffect(long stdTime) @safe const nothrow
+ override bool dstInEffect(long stdTime) @safe const scope nothrow
{
assert(!_transitions.empty);
@@ -1943,7 +1943,7 @@ public:
stdTime = The UTC time that needs to be adjusted to this time zone's
time.
+/
- override long utcToTZ(long stdTime) @safe const nothrow
+ override long utcToTZ(long stdTime) @safe const scope nothrow
{
assert(!_transitions.empty);
@@ -1968,7 +1968,7 @@ public:
adjTime = The time in this time zone that needs to be adjusted to
UTC time.
+/
- override long tzToUTC(long adjTime) @safe const nothrow
+ override long tzToUTC(long adjTime) @safe const scope nothrow
{
assert(!_transitions.empty, "UTC offset's not available");
@@ -2691,7 +2691,7 @@ private:
}
- int calculateLeapSeconds(long stdTime) @safe const pure nothrow
+ int calculateLeapSeconds(long stdTime) @safe const scope pure nothrow
{
if (_leapSeconds.empty)
return 0;
@@ -2864,7 +2864,7 @@ version (StdDdoc)
current dates but will still return true for `hasDST` because the
time zone did at some point have DST.
+/
- @property override bool hasDST() @safe const nothrow;
+ @property override bool hasDST() @safe const scope nothrow;
/++
@@ -2876,7 +2876,7 @@ version (StdDdoc)
stdTime = The UTC time that needs to be checked for DST in this
time zone.
+/
- override bool dstInEffect(long stdTime) @safe const nothrow;
+ override bool dstInEffect(long stdTime) @safe const scope nothrow;
/++
@@ -2888,7 +2888,7 @@ version (StdDdoc)
stdTime = The UTC time that needs to be adjusted to this time
zone's time.
+/
- override long utcToTZ(long stdTime) @safe const nothrow;
+ override long utcToTZ(long stdTime) @safe const scope nothrow;
/++
@@ -2900,7 +2900,7 @@ version (StdDdoc)
adjTime = The time in this time zone that needs to be adjusted
to UTC time.
+/
- override long tzToUTC(long adjTime) @safe const nothrow;
+ override long tzToUTC(long adjTime) @safe const scope nothrow;
/++
@@ -2945,9 +2945,9 @@ version (StdDdoc)
else
alias TIME_ZONE_INFORMATION = void*;
- static bool _dstInEffect(const TIME_ZONE_INFORMATION* tzInfo, long stdTime) nothrow;
- static long _utcToTZ(const TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) nothrow;
- static long _tzToUTC(const TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) nothrow;
+ static bool _dstInEffect(const scope TIME_ZONE_INFORMATION* tzInfo, long stdTime) nothrow;
+ static long _utcToTZ(const scope TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) nothrow;
+ static long _tzToUTC(const scope TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) nothrow;
this() immutable pure
{
@@ -2967,25 +2967,25 @@ else version (Windows)
public:
- @property override bool hasDST() @safe const nothrow
+ @property override bool hasDST() @safe const scope nothrow
{
return _tzInfo.DaylightDate.wMonth != 0;
}
- override bool dstInEffect(long stdTime) @safe const nothrow
+ override bool dstInEffect(long stdTime) @safe const scope nothrow
{
return _dstInEffect(&_tzInfo, stdTime);
}
- override long utcToTZ(long stdTime) @safe const nothrow
+ override long utcToTZ(long stdTime) @safe const scope nothrow
{
return _utcToTZ(&_tzInfo, stdTime, hasDST);
}
- override long tzToUTC(long adjTime) @safe const nothrow
+ override long tzToUTC(long adjTime) @safe const scope nothrow
{
return _tzToUTC(&_tzInfo, adjTime, hasDST);
}
@@ -3071,7 +3071,7 @@ else version (Windows)
private:
- static bool _dstInEffect(const TIME_ZONE_INFORMATION* tzInfo, long stdTime) @trusted nothrow
+ static bool _dstInEffect(const scope TIME_ZONE_INFORMATION* tzInfo, long stdTime) @trusted nothrow
{
try
{
@@ -3155,7 +3155,7 @@ else version (Windows)
}
- static long _utcToTZ(const TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) @safe nothrow
+ static long _utcToTZ(const scope TIME_ZONE_INFORMATION* tzInfo, long stdTime, bool hasDST) @safe nothrow
{
if (hasDST && WindowsTimeZone._dstInEffect(tzInfo, stdTime))
return stdTime - convert!("minutes", "hnsecs")(tzInfo.Bias + tzInfo.DaylightBias);
@@ -3164,7 +3164,7 @@ else version (Windows)
}
- static long _tzToUTC(const TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) @trusted nothrow
+ static long _tzToUTC(const scope TIME_ZONE_INFORMATION* tzInfo, long adjTime, bool hasDST) @trusted nothrow
{
if (hasDST)
{