Remove a non-standard turd: strtotimeval.
Change-Id: I1b1e40746cb573e3fb73a5276969b40c5da36d15
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index b0346d4..7826651 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -29,6 +29,8 @@
// This file perpetuates the mistakes of the past, but only for 32-bit targets.
#if !defined(__LP64__)
+#include <ctype.h>
+#include <inttypes.h>
#include <pthread.h>
#include <stdlib.h>
#include <sys/resource.h>
@@ -87,4 +89,31 @@
return 0;
}
+// Non-standard cruft that should only ever have been in system/core/toolbox.
+extern "C" char* strtotimeval(const char* str, struct timeval* ts) {
+ char* s;
+ ts->tv_sec = strtoumax(str, &s, 10);
+
+ long fractional_seconds = 0;
+ if (*s == '.') {
+ s++;
+ int count = 0;
+
+ // Read up to 6 digits (microseconds).
+ while (*s && isdigit(*s)) {
+ if (++count < 7) {
+ fractional_seconds = fractional_seconds*10 + (*s - '0');
+ }
+ s++;
+ }
+
+ for (; count < 6; count++) {
+ fractional_seconds *= 10;
+ }
+ }
+
+ ts->tv_usec = fractional_seconds;
+ return s;
+}
+
#endif