revert between 56095 -> 55830 in arch
[AROS.git] / compiler / posixc / ftime.c
blob8c05c1d1ba40b7b8ed52aca336dac9b0406fcdd4
1 /*
2 Copyright © 2004-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2001 function ftime().
6 Function is deprecated and removed from POSIX.1-2008
7 */
8 #include <sys/time.h>
10 /*****************************************************************************
12 NAME */
13 #include <sys/timeb.h>
15 int ftime(
17 /* SYNOPSIS */
18 struct timeb *tb)
20 /* FUNCTION
21 Get info on current time and timezone.
23 INPUTS
24 tb - Structure to fill in time, it has the following fields
25 * time: time in seconds since UNIX epoch
26 * millitm: milliseconds since last second
27 * timezone: minutes time west of Greenwich
28 * dstflag: type of daylight saving time
29 millitm is currently always multiple of 1000
30 dstflag is the same as from timezone information from the
31 gettimeofday() function.
33 RESULT
34 Always returns 0.
36 NOTES
37 This function is deprecated and not present anymore in POSIX.1-2008.
38 This function should not be used in new code and old code should
39 be fixed to remove usage.
40 As an alternative gettimeofday() can be used.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 gettimeofday()
49 INTERNALS
50 This function is part of libarosc.a and may be removed in the future.
52 ******************************************************************************/
54 struct timeval tv;
55 struct timezone tz;
57 gettimeofday(&tv, &tz);
59 tb->time = tv.tv_sec;
60 tb->millitm = tv.tv_usec*1000;
61 tb->timezone = tz.tz_minuteswest;
62 tb->dstflag = tz.tz_dsttime;
64 return 0;