summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/time.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/lib/time.c b/source4/lib/time.c
index 0bc5fcd3fc..65b85b2180 100644
--- a/source4/lib/time.c
+++ b/source4/lib/time.c
@@ -428,3 +428,21 @@ NTTIME pull_nttime(void *base, uint16 offset)
return ret;
}
+
+/*
+ parse a nttime as a integer in a string and return a NTTIME
+*/
+NTTIME nttime_from_string(const char *s)
+{
+ double t = 0;
+ const double t32 = 4294967296.0;
+ NTTIME ret;
+ /* i wish we could rely on 64 bit systems and sscanf %llu */
+ if (sscanf(s, "%lf", &t) != 1) {
+ ret.low = 0;
+ ret.high = 0;
+ }
+ ret.high = t / t32;
+ ret.low = t - (ret.high*t32);
+ return ret;
+}