]>
git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/clAppUtils/timeStr.h
5 #include <Security/x509defs.h>
7 #define UTC_TIME_STRLEN 13
8 #define CSSM_TIME_STRLEN 14 /* no trailing 'Z' */
9 #define GENERALIZED_TIME_STRLEN 15
16 * Given a string containing either a UTC-style or "generalized time"
17 * time string, convert to a struct tm (in GMT/UTC). Returns nonzero on
20 int appTimeStringToTm(
31 /* Caller must CSSM_FREE() the resulting string */
32 char *appTimeAtNowPlus(int secFromNow
,
35 /*** for backwards compatibility ***/
38 * Malloc and return UTC (2-digit year) time string, for time with specified
39 * offset from present. This uses the stdlib gmtime(), which is not thread safe.
40 * Even though this function protects the call with a lock, the TP also uses
41 * gmtime. It also does the correct locking for its own calls to gmtime()Êbut
42 * the is no way to synchronize TP's calls to gmtime() with the calls to this
43 * one other than only using this one when no threads might be performing TP ops.
45 char *utcAtNowPlus(int secFromNow
);
48 * Same thing, generalized time (4-digit year).
50 char *genTimeAtNowPlus(int secFromNow
);
53 * Free the string obtained from the above.
55 void freeTimeString(char *timeStr
);
57 char *x509TimeToCssmTimestring(
58 const CSSM_X509_TIME
*x509Time
,
59 unsigned *rtnLen
); // for caller's convenience
65 #endif /* _TIME_STR_H_ */