xref: /onnv-gate/usr/src/lib/libast/common/comp/mktime.c (revision 12068:08a39a083754)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*12068SRoger.Faulkner@Oracle.COM *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                  David Korn <dgk@research.att.com>                   *
194887Schin *                   Phong Vo <kpv@research.att.com>                    *
204887Schin *                                                                      *
214887Schin ***********************************************************************/
224887Schin #pragma prototyped
234887Schin /*
244887Schin  * mktime implementation
254887Schin  */
264887Schin 
274887Schin #define mktime		______mktime
284887Schin 
294887Schin #include <ast.h>
304887Schin #include <tm.h>
314887Schin 
324887Schin #undef	mktime
334887Schin 
344887Schin #undef	_def_map_ast
354887Schin #include <ast_map.h>
364887Schin 
374887Schin #undef	_lib_mktime	/* we can pass X/Open */
384887Schin 
394887Schin #if _lib_mktime
404887Schin 
414887Schin NoN(mktime)
424887Schin 
434887Schin #else
444887Schin 
454887Schin #if defined(__EXPORT__)
464887Schin #define extern	__EXPORT__
474887Schin #endif
484887Schin 
494887Schin extern time_t
504887Schin mktime(struct tm* ts)
514887Schin {
524887Schin 	time_t	t;
534887Schin 	Tm_t	tm;
544887Schin 
554887Schin 	tm.tm_sec = ts->tm_sec;
564887Schin 	tm.tm_min = ts->tm_min;
574887Schin 	tm.tm_hour = ts->tm_hour;
584887Schin 	tm.tm_mday = ts->tm_mday;
594887Schin 	tm.tm_mon = ts->tm_mon;
604887Schin 	tm.tm_year = ts->tm_year;
614887Schin 	tm.tm_wday = ts->tm_wday;
624887Schin 	tm.tm_yday = ts->tm_yday;
634887Schin 	tm.tm_isdst = ts->tm_isdst;
644887Schin 	t = tmtime(&tm, TM_LOCALZONE);
654887Schin 	ts->tm_sec = tm.tm_sec;
664887Schin 	ts->tm_min = tm.tm_min;
674887Schin 	ts->tm_hour = tm.tm_hour;
684887Schin 	ts->tm_mday = tm.tm_mday;
694887Schin 	ts->tm_mon = tm.tm_mon;
704887Schin 	ts->tm_year = tm.tm_year;
714887Schin 	ts->tm_wday = tm.tm_wday;
724887Schin 	ts->tm_yday = tm.tm_yday;
734887Schin 	ts->tm_isdst = tm.tm_isdst;
744887Schin 	return t;
754887Schin }
764887Schin 
774887Schin #endif
78