Revert "Revert "Remove ftime from bionic LP64""

This reverts commit 0921204660.

Change-Id: I749af8d7d429cda9f9d09a75bd30df54e6b1dd65
This commit is contained in:
Dan Albert
2014-06-05 02:10:49 +00:00
parent 9a3ad98fd6
commit ac6467587e
4 changed files with 30 additions and 97 deletions

View File

@@ -266,4 +266,34 @@ extern "C" int getdtablesize() {
return r.rlim_cur;
}
// 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 2008.
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