Remove ftime from bionic LP64
Bug: 13935372
Change-Id: I5dd31147143b23a090a3b75b846dc5354e599121
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index ed60ea4..5dd31bf 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -226,4 +226,35 @@
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