1 /*
2  * This file belongs to FreeMiNT.  It's not in the original MiNT 1.12
3  * distribution.  See the file Changes.MH for a detailed log of changes.
4  */
5 
6 /*
7  * Copyright (C) 1998 by Guido Flohr.
8  */
9 
10 # ifndef _mint_time_h
11 # define _mint_time_h
12 
13 typedef struct time TIME;
14 
15 struct time
16 {
17 	long	high_time;
18 	long	time;		/* This has to be signed!  */
19 	ulong	nanoseconds;
20 };
21 
22 #define dta_UTC_local_dos(dta,xattr,x)					\
23 {									\
24 	union { ushort s[2]; ulong l;} data;				\
25 									\
26 	/* UTC -> localtime -> DOS style */				\
27 	data.s[0]	= xattr.x##time;			\
28 	data.s[1]	= xattr.x##date;			\
29 	data.l		= dostime(data.l - timezone);			\
30 	dta->dta_time	= data.s[0];					\
31 	dta->dta_date	= data.s[1];					\
32 }
33 
34 #define xtime_to_local_dos(a,x)				\
35 {							\
36 	union { ushort s[2]; ulong l;} data;		\
37 	data.s[0] = a->x##time;		\
38 	data.s[1] = a->x##date;		\
39 	data.l = dostime(data.l - timezone);		\
40 	a->x##time = data.s[0];		\
41 	a->x##date = data.s[1];		\
42 }
43 
44 #define SET_XATTR_TD(a,x,ut)			\
45 {						\
46 	union { ushort s[2]; ulong l;} data;	\
47 	data.l = ut;				\
48 	a->x##time = data.s[0];	\
49 	a->x##date = data.s[1];	\
50 }
51 
52 long        _cdecl dostime          (long tv_sec);
53 long        _cdecl unixtime         (unsigned short time, unsigned short date);
54 long        _cdecl unix2xbios       (long tv_sec);
55 void	_cdecl unix2calendar	(long tv_sec,
56 				 unsigned short *year, unsigned short *month,
57 				 unsigned short *day, unsigned short *hour,
58 				 unsigned short *minute, unsigned short *second);
59 
60 # endif /* _mint_time_h */
61