mirror of
https://gitlab.freedesktop.org/libfprint/fprintd.git
synced 2026-05-09 07:08:03 +02:00
pam: Add monotonic clock helper
This commit is contained in:
parent
0b598965b0
commit
f7557c6ee7
1 changed files with 12 additions and 0 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
|
@ -61,6 +62,17 @@ static gboolean debug = FALSE;
|
|||
static guint max_tries = DEFAULT_MAX_TRIES;
|
||||
static guint timeout = DEFAULT_TIMEOUT;
|
||||
|
||||
#define USEC_PER_SEC ((uint64_t) 1000000ULL)
|
||||
#define NSEC_PER_USEC ((uint64_t) 1000ULL)
|
||||
|
||||
static uint64_t
|
||||
now (void)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime (CLOCK_MONOTONIC, &ts);
|
||||
return (uint64_t) ts.tv_sec * USEC_PER_SEC + (uint64_t) ts.tv_nsec / NSEC_PER_USEC;
|
||||
}
|
||||
|
||||
static gboolean send_info_msg(pam_handle_t *pamh, const char *msg)
|
||||
{
|
||||
const struct pam_message mymsg = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue