summaryrefslogtreecommitdiff
path: root/src/time.c
blob: b29c2eb0577310ab936e2059e108add8bdb507c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
 *
 * This file is part of libnsutils.
 *
 * Licensed under the MIT License,
 *                http://www.opensource.org/licenses/mit-license.php
 */

/**
 * \file
 * Time operation implementation
 */

#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>

#include "nsutils/time.h"

/* exported interface documented in nsutils/time.h */
nsuerror nsu_getmonotonic_ms(uint64_t *current)
{
    /** \todo Implement this properly! */
    struct timeval tv;

    gettimeofday(&tv, NULL);

    *current = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);

    return NSUERROR_OK;
}