smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.64k stars 404 forks source link

Pass the now time when creating the iface #799

Closed thvdveld closed 1 year ago

thvdveld commented 1 year ago

I think that the now time should be passed to the interface when creating it. For RPL for example, some timers need to be created (Trickle timer for DIO's or a timer for DIS). Passing the now time makes this very easy. Having an interface with Instant::ZERO is also not really correct.

For the tests, the now time is ZERO, because we don't have a source when not using std.

codecov[bot] commented 1 year ago

Codecov Report

Merging #799 (533f103) into master (8f4820f) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #799   +/-   ##
=======================================
  Coverage   80.32%   80.32%           
=======================================
  Files          72       72           
  Lines       29060    29060           
=======================================
  Hits        23341    23341           
  Misses       5719     5719           
Impacted Files Coverage Δ
src/iface/interface/mod.rs 49.31% <100.00%> (ø)
src/iface/interface/tests.rs 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Dirbaio commented 1 year ago

Makes a lot of sense, Thank you! :)