]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/lib/cssmdatetime.h
2 * Copyright (c) 1997-2002,2004,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 * cssmdatetime.h -- defines for the CSSM date and time utilities for the Mac
28 #ifndef _SECURITY_CSSMDATETIME_H_
29 #define _SECURITY_CSSMDATETIME_H_
31 #include <Security/cssm.h>
32 #include <CoreFoundation/CFDate.h>
37 namespace CSSMDateTimeUtils
40 // Get the current time.
41 extern void GetCurrentMacLongDateTime(sint64
&outMacDate
);
43 extern void TimeStringToMacSeconds(const CSSM_DATA
&inUTCTime
, uint32
&ioMacDate
);
44 extern void TimeStringToMacLongDateTime(const CSSM_DATA
&inUTCTime
, sint64
&outMacDate
);
46 // Length of inLength is an input parameter and must be 14 or 16.
47 // The outData parameter must point to a buffer of at least inLength bytes.
48 extern void MacSecondsToTimeString(uint32 inMacDate
, uint32 inLength
, void *outData
);
49 extern void MacLongDateTimeToTimeString(const sint64
&inMacDate
,
50 uint32 inLength
, void *outData
);
52 // outCssmDate must be a pointer to a 16 byte buffer.
53 extern void CFDateToCssmDate(CFDateRef date
, char *outCssmDate
);
55 // cssmDate must be a pointer to a 16 byte buffer formatted as follows: "YYYYMMDDhhmmssZ\0".
56 extern void CssmDateToCFDate(const char *cssmDate
, CFDateRef
*outCFDate
);
58 // cssmDate must be a pointer to a string buffer formatted as follows: "[YY]YYMMDDhhmmssZ[\0]".
59 // handles UTC (2-digit year) or generalized (4-digit year) date strings; terminated or not.
60 // also handles localized time formats: "[YY]MMDDhhmmssThhmm" (where T=[+,-]).
61 extern int CssmDateStringToCFDate(const char *cssmDate
, unsigned int len
, CFDateRef
*outCFDate
);
63 } // end namespace CSSMDateTimeUtils
65 } // end namespace Security
67 #endif // !_SECURITY_CSSMDATETIME_H_