File: tws.h

package info (click to toggle)
xphoon 20000613%2B0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 604 kB
  • ctags: 301
  • sloc: ansic: 2,013; makefile: 7; sh: 1
file content (79 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* tws.h - header file for libtws date/time library */


/* Definition of the tws data structure. */

struct tws {
    int     tw_sec;
    int     tw_min;
    int     tw_hour;

    int     tw_mday;
    int     tw_mon;
    int     tw_year;

    int     tw_wday;
    int     tw_yday;

    int     tw_zone;

    long    tw_clock;

    int     tw_flags;
#define TW_NULL 0x0000
#define TW_SDAY 0x0007		/* how day-of-week was determined */
#define   TW_SNIL 0x0000	/*   not given */
#define   TW_SEXP 0x0001	/*   explicitly given */
#define   TW_SIMP 0x0002	/*   implicitly given */
#define TW_DST  0x0010		/* daylight savings time */
#define TW_ZONE 0x0020		/* use numeric timezones only */
#define TW_JUNK 0x0040		/* date string contained junk */
};


/* Declarations of routines. */

void twscopy( );
	/* twscopy( &totws, &fromtws ) copies a tws */
int twsort( );
	/* twsort( &tws1, &tws2 ) compares two tws's: 1 means tws1 is
	   later; -1 means tws1 is earlier; 0 means they are equal */
long twclock( );
	/* twclock( &tws ) turns a tws into a time(3)-style clock value */
long twjuliandate( );
	/* twjuliandate( &tws ) returns the Julian day number of a tws */
long twsubtract( );
	/* twsubtract( &tws1, &tws2 ) returns seconds of difference */

/* These routines are functionally similar to the ctime(3) routines
   in the standard Unix library. */
char *dctime( );
	/* dctime( &tws ) returns a string for the date/time passed in */
struct tws *dlocaltime( );
	/* dlocaltime( &clock ) turns a time(3) clock value into a tws */
struct tws *dgmtime( );
	/* dgmtime( &clock ) turns a time(3) clock value into a tws */
char *dasctime( );
	/* dasctime( &tws, flags ) turns a tws into a string */
char *dtimezone( );
	/* dtimezone( offset, flags ) returns the name of the time zone */

char *dtimenow( );
	/* dtimenow( ) returns a string for the current date/time */

struct tws *dparsetime( );
	/* dparsetime( &str ) turns a string into a tws */

struct tws *dtwstime( );
	/* dtwstime( ) returns a tws for the current date/time */

#ifdef ATZ
#define dtime(cl) dasctime( dlocaltime( cl ), TW_NULL )
#else
#define dtime(cl) dasctime( dlocaltime( cl ), TW_ZONE )
#endif

#define dtwszone(tw) dtimezone( tw -> tw_zone, tw -> tw_flags )


extern char   *tw_dotw[], *tw_ldotw[], *tw_moty[];