blob: 33b3b4e6c3911dd63838329d49ff4ac38f77ddfc [file] [log] [blame]
Greg Clayton3fb2c932013-02-16 22:46:58 +00001//===--------------------- TimeSpecTimeout.cpp ------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "TimeSpecTimeout.h"
11
12using namespace lldb_private;
13
14const struct timespec *
15TimeSpecTimeout::SetAbsoluteTimeoutMircoSeconds32 (uint32_t timeout_usec)
16{
17 if (timeout_usec == UINT32_MAX)
18 {
19 m_infinite = true;
20 }
21 else
22 {
23 m_infinite = false;
24 TimeValue time_value(TimeValue::Now());
25 time_value.OffsetWithMicroSeconds(timeout_usec);
26 m_timespec = time_value.GetAsTimeSpec();
27 }
28 return GetTimeSpecPtr ();
29}
30
31const struct timespec *
32TimeSpecTimeout::SetRelativeTimeoutMircoSeconds32 (uint32_t timeout_usec)
33{
34 if (timeout_usec == UINT32_MAX)
35 {
36 m_infinite = true;
37 }
38 else
39 {
40 m_infinite = false;
41 TimeValue time_value;
42 time_value.OffsetWithMicroSeconds(timeout_usec);
43 m_timespec = time_value.GetAsTimeSpec();
44 }
45 return GetTimeSpecPtr ();
46}
47
48