Remove ftime from bionic LP64
Bug: 13935372 Change-Id: I5dd31147143b23a090a3b75b846dc5354e599121
This commit is contained in:
@@ -226,4 +226,35 @@ extern "C" wchar_t* wcswcs(wchar_t* haystack, wchar_t* needle) {
|
||||
return wcsstr(haystack, needle);
|
||||
}
|
||||
|
||||
// Only used by ftime, which was removed from POSIX.
|
||||
struct timeb {
|
||||
time_t time;
|
||||
unsigned short millitm;
|
||||
short timezone;
|
||||
short dstflag;
|
||||
};
|
||||
|
||||
// This was removed from POSIX.
|
||||
extern "C" int ftime(struct timeb* tb)
|
||||
{
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
|
||||
if (gettimeofday(&tv, &tz) < 0)
|
||||
return -1;
|
||||
|
||||
tb->time = tv.tv_sec;
|
||||
tb->millitm = (tv.tv_usec + 500) / 1000;
|
||||
|
||||
if (tb->millitm == 1000) {
|
||||
++tb->time;
|
||||
tb->millitm = 0;
|
||||
}
|
||||
|
||||
tb->timezone = tz.tz_minuteswest;
|
||||
tb->dstflag = tz.tz_dsttime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user