Skip to content

Commit

Permalink
Update DateTime.Now in intterupt support for v1500
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Nov 28, 2023
1 parent cb0ac7c commit 917d541
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/Meadow.Core/Hardware/BiDirectionalInterruptPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ private void OnInterrupt(IPin pin, bool state)
if (pin == this.Pin)
{
var capturedLastTime = LastEventTime; // note: doing this for latency reasons. kind of. sort of. bad time good time. all time.
this.LastEventTime = DateTime.UtcNow;
this.LastEventTime = DateTime.Now;
// BC 2021.05.21 b5.0: Changed this to the new result type.
// assuming that old state is just an inversion of the new state, yeah?
RaiseChangedAndNotify(new DigitalPortResult(new DigitalState(state, this.LastEventTime), new DigitalState(!state, capturedLastTime)));
Expand Down
2 changes: 1 addition & 1 deletion source/Meadow.Core/Hardware/DigitalInterruptPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void OnInterrupt(IPin pin, bool state)
{
// this is all to prevent new-ing up (and thereby preventing GC stuff)
_oldState.Time = LastEventTime; // note: doing this for latency reasons. kind of. sort of. bad time good time. all time.
_newState.Time = this.LastEventTime = DateTime.UtcNow;
_newState.Time = this.LastEventTime = DateTime.Now;
_oldState.State = !state;
_newState.State = state;
_interruptResult.Old = (LastEventTime == DateTime.MinValue) ? null : _oldState;
Expand Down

0 comments on commit 917d541

Please sign in to comment.