blob: 3bb4a898c7127fe601520515228376595ee5beb5 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains Mojo system time-related declarations/definitions.
//
// Note: This header should be compilable as C.
#ifndef MOJO_PUBLIC_C_SYSTEM_TIME_H_
#define MOJO_PUBLIC_C_SYSTEM_TIME_H_
#include <stdint.h>
// |MojoTimeTicks|: A time delta, in microseconds, the meaning of which is
// source-dependent.
typedef int64_t MojoTimeTicks;
// |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except
// for |MOJO_DEADLINE_INDEFINITE|).
// |MOJO_DEADLINE_INDEFINITE| - Used to indicate "forever".
typedef uint64_t MojoDeadline;
#define MOJO_DEADLINE_INDEFINITE ((MojoDeadline)-1)
#ifdef __cplusplus
extern "C" {
#endif
// Note: Pointer parameters that are labelled "optional" may be null (at least
// under some circumstances). Non-const pointer parameters are also labeled
// "in", "out", or "in/out", to indicate how they are used. (Note that how/if
// such a parameter is used may depend on other parameters or the requested
// operation's success/failure. E.g., a separate |flags| parameter may control
// whether a given "in/out" parameter is used for input, output, or both.)
// Returns the time, in microseconds, since some undefined point in the past.
// The values are only meaningful relative to other values that were obtained
// from the same device without an intervening system restart. Such values are
// guaranteed to be monotonically non-decreasing with the passage of real time.
// Although the units are microseconds, the resolution of the clock may vary and
// is typically in the range of ~1-15 ms.
MojoTimeTicks MojoGetTimeTicksNow(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // MOJO_PUBLIC_C_SYSTEM_TIME_H_