Skip to content

Commit

Permalink
examples/tap_network: switch to new libtock alarm APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
lschuermann committed Jan 27, 2025
1 parent 9bcf865 commit ba5f640
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/tap_network/main.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* vim: set sw=2 expandtab tw=80: */

#include <tock.h>
#include <stdio.h>
#include <string.h>
#include <internal/alarm.h>

#include <libtock/tock.h>
#include <libtock/services/alarm.h>

#include <lwip/sys.h>
#include <lwip/prot/ethernet.h>
Expand Down Expand Up @@ -54,9 +55,9 @@ void sys_arch_unprotect(__attribute__((unused)) sys_prot_t pval) {}
// Provide a reference to the current time in milliseconds, such that LwIP can
// timeout TCP connections properly, etc.
uint32_t sys_now(void) {
uint32_t now;
alarm_internal_read(&now);
return now;
struct timeval tv;
libtock_alarm_gettimeasticks(&tv);
return (tv.tv_usec / 1000) + (tv.tv_sec * 1000);
}

// A received, but not yet processed LwIP packet. This is written in the packet
Expand Down

0 comments on commit ba5f640

Please sign in to comment.