Windows: Use secure ctime and strncpy in afs_ctime
[openafs.git] / src / util / ktime.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __INCL_KTIME_
11 #define __INCL_KTIME_ 1
12
13 #undef min                      /* redefined at end of file */
14 struct ktime_date {
15     afs_int32 mask;             /* mask of valid fields */
16     short year;
17     short month;
18     short day;
19     short hour;
20     short min;
21     short sec;
22 };
23
24 /* could we make these bits the same? */
25
26 #define KTIMEDATE_YEAR          1
27 #define KTIMEDATE_MONTH         2
28 #define KTIMEDATE_DAY           4
29 #define KTIMEDATE_HOUR          8
30 #define KTIMEDATE_MIN           0x10
31 #define KTIMEDATE_SEC           0x20
32 #define KTIMEDATE_NEVER         0x1000  /* special case for never */
33 #define KTIMEDATE_NOW           0x2000  /* special case for now */
34
35 /* note that this if different from the value used by ParcePeriodic (sigh). */
36 #define KTIMEDATE_NEVERDATE     0xffffffff
37
38 struct ktime {
39     int mask;
40     short hour;                 /* 0 - 23 */
41     short min;                  /* 0 - 60 */
42     short sec;                  /* 0 - 60 */
43     short day;                  /* 0 is sunday */
44 };
45
46 #define KTIME_HOUR      1       /* hour should match */
47 #define KTIME_MIN       2
48 #define KTIME_SEC       4
49 #define KTIME_TIME      7       /* all times should match */
50 #define KTIME_DAY       8       /* day should match */
51 #define KTIME_NEVER     0x10    /* special case: never */
52 #define KTIME_NOW       0x20    /* special case: right now */
53
54 #define ktime_DateToLong        ktime_DateToInt32       /* XXX */
55 #define ktimeRelDate_ToLong     ktimeRelDate_ToInt32    /* XXX */
56 #define LongTo_ktimeRelDate     Int32To_ktimeRelDate    /* XXX */
57
58 afs_int32 ktime_InterpretDate(struct ktime_date *akdate);
59
60 #define min(a,b) (((a) < (b)) ? (a) : (b))
61 #endif /* __INCL_KTIME_ */