]> git.proxmox.com Git - ceph.git/blame - ceph/src/common/Clock.cc
update sources to v12.1.0
[ceph.git] / ceph / src / common / Clock.cc
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15
16#include "common/Clock.h"
7c673cae
FG
17
18utime_t ceph_clock_now()
19{
20#if defined(__linux__)
21 struct timespec tp;
22 clock_gettime(CLOCK_REALTIME, &tp);
23 utime_t n(tp);
24#else
25 struct timeval tv;
26 gettimeofday(&tv, NULL);
27 utime_t n(&tv);
28#endif
29 return n;
30}
31
32time_t ceph_clock_gettime()
33{
34 return time(NULL);
35}