mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 05:20:32 +01:00
cli: utilize nm_utils_get_timestamp_msec()
This commit is contained in:
parent
0132da1ddb
commit
5269aba7b4
1 changed files with 4 additions and 11 deletions
|
|
@ -2765,12 +2765,12 @@ wifi_list_aps (NMDeviceWifi *wifi,
|
|||
GArray *out_indices,
|
||||
const NMMetaAbstractInfo *const*tmpl,
|
||||
const char *bssid_user,
|
||||
int rescan_cutoff)
|
||||
gint64 rescan_cutoff)
|
||||
{
|
||||
gboolean needs_rescan;
|
||||
WifiListData *data;
|
||||
|
||||
needs_rescan = rescan_cutoff < 0 || (rescan_cutoff > 0 && nm_device_wifi_get_last_scan (wifi) < (rescan_cutoff * 1000));
|
||||
needs_rescan = rescan_cutoff < 0 || (rescan_cutoff > 0 && nm_device_wifi_get_last_scan (wifi) < rescan_cutoff);
|
||||
|
||||
if (needs_rescan) {
|
||||
data = g_slice_new0 (WifiListData);
|
||||
|
|
@ -2825,7 +2825,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
|
|||
const NMMetaAbstractInfo *const*tmpl;
|
||||
gs_unref_array GArray *out_indices = NULL;
|
||||
int option;
|
||||
int rescan_cutoff;
|
||||
guint64 rescan_cutoff;
|
||||
|
||||
devices = nmc_get_devices_sorted (nmc->client);
|
||||
|
||||
|
|
@ -2895,14 +2895,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
|
|||
g_printerr (_("Unknown parameter: %s\n"), *argv);
|
||||
|
||||
if (rescan == NULL || strcmp (rescan, "auto") == 0) {
|
||||
struct timespec tp;
|
||||
|
||||
if (clock_gettime (CLOCK_BOOTTIME, &tp) == -1) {
|
||||
g_printerr (_("Failed to get CLOCK_BOOTTIME: %s\n"), strerror (errno));
|
||||
rescan_cutoff = 0;
|
||||
} else {
|
||||
rescan_cutoff = MAX (tp.tv_sec - 30, 0);
|
||||
}
|
||||
rescan_cutoff = NM_MAX (nm_utils_get_timestamp_msec () - 30 * NM_UTILS_MSEC_PER_SECOND, 0);
|
||||
} else if (strcmp (rescan, "no") == 0) {
|
||||
rescan_cutoff = 0;
|
||||
} else if (strcmp (rescan, "yes") == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue