Skip to content

Commit

Permalink
Merge pull request #4333 from BBasile/issue-15991
Browse files Browse the repository at this point in the history
fix issue 15991 - std.datetime.StopWatch is not @nogc
  • Loading branch information
Hackerpilot committed May 18, 2016
2 parents 0ed7fe1 + 41de4f1 commit 88966f9
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions std/datetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -31700,27 +31700,27 @@ public:
/++
Auto start with constructor.
+/
this(AutoStart autostart)
this(AutoStart autostart) @nogc
{
if (autostart)
start();
}

@safe unittest
@nogc @safe unittest
{
auto sw = StopWatch(AutoStart.yes);
sw.stop();
}


///
bool opEquals(const StopWatch rhs) const pure nothrow
bool opEquals(const StopWatch rhs) const pure nothrow @nogc
{
return opEquals(rhs);
}

/// ditto
bool opEquals(const ref StopWatch rhs) const pure nothrow
bool opEquals(const ref StopWatch rhs) const pure nothrow @nogc
{
return _timeStart == rhs._timeStart &&
_timeMeasured == rhs._timeMeasured;
Expand All @@ -31730,7 +31730,7 @@ public:
/++
Resets the stop watch.
+/
void reset()
void reset() @nogc
{
if (_flagStarted)
{
Expand All @@ -31747,7 +31747,7 @@ public:
}

///
@safe unittest
@nogc @safe unittest
{
StopWatch sw;
sw.start();
Expand All @@ -31760,14 +31760,14 @@ public:
/++
Starts the stop watch.
+/
void start()
void start() @nogc
{
assert(!_flagStarted);
_flagStarted = true;
_timeStart = TickDuration.currSystemTick;
}

@trusted unittest
@nogc @trusted unittest
{
StopWatch sw;
sw.start();
Expand All @@ -31786,14 +31786,14 @@ public:
/++
Stops the stop watch.
+/
void stop()
void stop() @nogc
{
assert(_flagStarted);
_flagStarted = false;
_timeMeasured += TickDuration.currSystemTick - _timeStart;
}

@trusted unittest
@nogc @trusted unittest
{
StopWatch sw;
sw.start();
Expand All @@ -31813,15 +31813,15 @@ public:
Peek at the amount of time which has passed since the stop watch was
started.
+/
TickDuration peek() const
TickDuration peek() const @nogc
{
if (_flagStarted)
return TickDuration.currSystemTick - _timeStart + _timeMeasured;

return _timeMeasured;
}

@safe unittest
@nogc @safe unittest
{
StopWatch sw;
sw.start();
Expand All @@ -31838,13 +31838,13 @@ public:
Set the amount of time which has been measured since the stop watch was
started.
+/
void setMeasured(TickDuration d)
void setMeasured(TickDuration d) @nogc
{
reset();
_timeMeasured = d;
}

@safe unittest
@nogc @safe unittest
{
StopWatch sw;
TickDuration t0;
Expand All @@ -31858,12 +31858,12 @@ public:
/++
Confirm whether this stopwatch is measuring time.
+/
bool running() @property const pure nothrow
bool running() @property const pure nothrow @nogc
{
return _flagStarted;
}

@safe unittest
@nogc @safe unittest
{
StopWatch sw1;
assert(!sw1.running);
Expand Down

0 comments on commit 88966f9

Please sign in to comment.