~wb-munzinger/+junk/sanlock

« back to all changes in this revision

Viewing changes to monotime.c

  • Committer: David Weber
  • Date: 2012-01-18 13:00:36 UTC
  • Revision ID: wb@munzinger.de-20120118130036-9a7wvhhmfuip7zx5
Tags: upstream-1.9
Import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010-2011 Red Hat, Inc.
 
3
 *
 
4
 * This copyrighted material is made available to anyone wishing to use,
 
5
 * modify, copy, or redistribute it subject to the terms and conditions
 
6
 * of the GNU General Public License v2 or (at your option) any later version.
 
7
 */
 
8
 
 
9
#include <unistd.h>
 
10
#include <stdint.h>
 
11
#include <time.h>
 
12
#include "monotime.h"
 
13
 
 
14
uint64_t monotime(void)
 
15
{
 
16
        struct timespec ts;
 
17
 
 
18
        clock_gettime(CLOCK_MONOTONIC, &ts);
 
19
 
 
20
        return ts.tv_sec;
 
21
}