Line | |
---|
1 | /*----------------------------------------------------------------------
|
---|
2 | jcdate.c :
|
---|
3 |
|
---|
4 | Function to get the hour/date of the system
|
---|
5 | modified 13-10-98, D. Petry
|
---|
6 |
|
---|
7 | ----------------------------------------------------------------------*/
|
---|
8 |
|
---|
9 | #include <stdio.h>
|
---|
10 | #include <stdlib.h>
|
---|
11 | #include <time.h>
|
---|
12 |
|
---|
13 | static int s0=0;
|
---|
14 |
|
---|
15 | /*--------------------------------------------------
|
---|
16 | jcdate:
|
---|
17 | --------------------------------------------------*/
|
---|
18 | #ifdef JC_UNDERSCORES
|
---|
19 | void
|
---|
20 | jcdate_ (int *id, int *it, int *isl1, int *isl2, int *isl3,
|
---|
21 | int *isl4, int *isl5, int *isl6 )
|
---|
22 | #else /* JC_NO_UNDERSCORES */
|
---|
23 | void
|
---|
24 | jcdate (int *id, int *it, int *isl1, int *isl2, int *isl3,
|
---|
25 | int *isl4, int *isl5, int *isl6 )
|
---|
26 | #endif /* JC_UNDERSCORES */
|
---|
27 | {
|
---|
28 | time_t timesecs;
|
---|
29 | struct tm *t;
|
---|
30 |
|
---|
31 | s0 = (int) time( ×ecs );
|
---|
32 | t = gmtime( ×ecs );
|
---|
33 | *isl1 = (int) t->tm_year;
|
---|
34 | *isl2 = (int) t->tm_mon+1;
|
---|
35 | *isl3 = (int) t->tm_mday;
|
---|
36 | *isl4 = (int) t->tm_hour;
|
---|
37 | *isl5 = (int) t->tm_min;
|
---|
38 | *isl6 = (int) t->tm_sec;
|
---|
39 |
|
---|
40 | *id = *isl1 * 10000 + *isl2 * 100 + *isl3;
|
---|
41 | *it = *isl4 * 10000 + *isl5 * 100 + *isl6;
|
---|
42 |
|
---|
43 | return;
|
---|
44 | }
|
---|
45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.