Commit | Line | Data |
---|---|---|
cf908fd1 WJ |
1 | /* tm2ut.c - tm to time string */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/psap/RCS/tm2ut.c,v 7.1 91/02/22 09:37:15 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/psap/RCS/tm2ut.c,v 7.1 91/02/22 09:37:15 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: tm2ut.c,v $ | |
12 | * Revision 7.1 91/02/22 09:37:15 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:13:54 mrose | |
16 | * Release 6.0 | |
17 | * | |
18 | */ | |
19 | ||
20 | /* | |
21 | * NOTICE | |
22 | * | |
23 | * Acquisition, use, and distribution of this module and related | |
24 | * materials are subject to the restrictions of a license agreement. | |
25 | * Consult the Preface in the User's Manual for the full terms of | |
26 | * this agreement. | |
27 | * | |
28 | */ | |
29 | ||
30 | ||
31 | /* LINTLIBRARY */ | |
32 | ||
33 | #include <stdio.h> | |
34 | #include "psap.h" | |
35 | #ifdef OSX | |
36 | #include <sys/time.h> | |
37 | #endif | |
38 | ||
39 | ||
40 | #define YEAR(y) ((y) >= 100 ? (y) : (y) + 1900) | |
41 | ||
42 | /* \f */ | |
43 | ||
44 | void tm2ut (tm, ut) | |
45 | register struct tm *tm; | |
46 | register UTC ut; | |
47 | { | |
48 | bzero ((char *) ut, sizeof *ut); | |
49 | ||
50 | ut -> ut_year = YEAR (tm -> tm_year); | |
51 | ut -> ut_mon = tm -> tm_mon + 1; | |
52 | ut -> ut_mday = tm -> tm_mday; | |
53 | ut -> ut_hour = tm -> tm_hour; | |
54 | ut -> ut_min = tm -> tm_min; | |
55 | ut -> ut_sec = tm -> tm_sec; | |
56 | ut -> ut_zone = 0; | |
57 | ||
58 | ut -> ut_flags = UT_ZONE | UT_SEC; | |
59 | } |