core_foundation_sys/
date.rs

1// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution.
3//
4// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7// option. This file may not be copied, modified, or distributed
8// except according to those terms.
9
10use std::os::raw::c_void;
11
12use crate::base::{CFAllocatorRef, CFComparisonResult, CFTypeID};
13
14#[repr(C)]
15pub struct __CFDate(c_void);
16
17pub type CFDateRef = *const __CFDate;
18
19pub type CFTimeInterval = f64;
20pub type CFAbsoluteTime = CFTimeInterval;
21
22extern "C" {
23    pub static kCFAbsoluteTimeIntervalSince1904: CFTimeInterval;
24    pub static kCFAbsoluteTimeIntervalSince1970: CFTimeInterval;
25
26    pub fn CFAbsoluteTimeGetCurrent() -> CFAbsoluteTime;
27
28    pub fn CFDateCreate(allocator: CFAllocatorRef, at: CFAbsoluteTime) -> CFDateRef;
29    pub fn CFDateGetAbsoluteTime(date: CFDateRef) -> CFAbsoluteTime;
30    pub fn CFDateGetTimeIntervalSinceDate(date: CFDateRef, other: CFDateRef) -> CFTimeInterval;
31    pub fn CFDateCompare(
32        date: CFDateRef,
33        other: CFDateRef,
34        context: *mut c_void,
35    ) -> CFComparisonResult;
36
37    pub fn CFDateGetTypeID() -> CFTypeID;
38}