summaryrefslogtreecommitdiff
path: root/release/src/router/bpalogin/get_time.c
blob: 62cbbbc9d4fba37b820db9eb2f8d8ca90cc0c9c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <sys/sysinfo.h>
#include <time.h>

#define USE_UPTIME 1

// When system time change, the lease table will error, so we use system uptime
time_t	// long int
get_time(time_t *t){
#ifdef USE_UPTIME
        struct sysinfo info;

        sysinfo(&info);

        return info.uptime;
#else
        return time(0);
#endif
}