1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

29 Commits

Author SHA1 Message Date
Martin Schwenke
bcf298e7ec lib/util: Add RFC3339 timestamp support to timeval_str_buf()
Note that this can't be done more simply or portably with strftime(3)
since "%z" isn't portable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Oct 13 12:27:04 CEST 2014 on sn-devel-104
2014-10-13 12:27:04 +02:00
Martin Schwenke
fd9f0c27e7 lib/util: Clean up includes for time.[ch]
Allows standalone compile without external includes.h.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-04 00:11:20 +02:00
Volker Lendecke
0753c1bec1 lib: Create time_basic.[ch]
Make the two functions that debug.c needs a subsystem of their own. The
goal is to put debug.c on a diet. Anybody who wants to use it should
not be forced to pull in half of Samba :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31 18:49:47 +02:00
Volker Lendecke
8799120abd lib: Use timeval_str_buf in timeval_string
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31 18:49:47 +02:00
Volker Lendecke
2aa1492c7b lib: Add timeval_str_buf
Similarly to server_id_str_buf it does not do any allocation

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31 18:49:46 +02:00
Volker Lendecke
379cbb6397 lib: Align nt_time_to_unix_timespec with unix_timespec_to_nt_time
Both take and return values now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-30 22:28:14 +02:00
Volker Lendecke
dcd6373613 lib: Align unix_timespec_to_nt_time with nt_time_to_unix_timespec
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-30 22:28:14 +02:00
Volker Lendecke
32b45bfa98 lib: Apply const to nt_time_to_unix_timespec
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Jun 18 16:35:26 CEST 2014 on sn-devel-104
2014-06-18 16:35:26 +02:00
Volker Lendecke
b2dfd57669 lib-util: add functions to get elapsed from given timespec structs
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-12 12:50:21 -08:00
Björn Jacke
cf87f85874 time: prefer CLOCK_BOOTTIME for clock_gettime_mono()
this clock moves on while the machine was suspended. This is what we prefer
actually.

Signed-off-by: Björn Jacke <bj@sernet.de>
Reviewed-by: Simo Sorce <idra@samba.org>

Autobuild-User(master): Simo Sorce <idra@samba.org>
Autobuild-Date(master): Fri Jul  5 16:47:34 CEST 2013 on sn-devel-104
2013-07-05 16:47:34 +02:00
Björn Jacke
e3c2dd13d4 time: don't try to use the coarse clock
as we prefer to use the suspend aware CLOCK_BOOTTIME as monotonic clock source
we cannot deal with the mono coarse clock any more. Actually I never saw a real
performance gain with it.

Signed-off-by: Björn Jacke <bj@sernet.de>
Reviewed-by: Simo Sorce <idra@samba.org>
2013-07-05 08:54:53 -04:00
Michael Adam
762dd3cf29 lib/util/time: strip a potential trailing newline in the asctime case.
If strftime() is not available, asctime() is used, and this usually
appends a newline character to the result. This is not desired for
timestamp().

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-19 13:58:08 +01:00
Andrew Bartlett
470cfb34ae lib/util: Map 0x7fffffffffffffffLL as 0x7fffffffffffffffLL in time conversion
TIME_T_MAX is not actually INT64_MAX at the moment, so check both
values and set to the magic end-of-time value.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue May  8 06:41:43 CEST 2012 on sn-devel-104
2012-05-08 06:41:43 +02:00
Jelmer Vernooij
56081da368 util/time: Make some functions explicitly public. 2011-11-03 17:22:40 +01:00
Stefan Metzmacher
66f8070dd3 lib/util: move some timespec helpers from source3 to the toplevel
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Sep 23 00:15:31 CEST 2011 on sn-devel-104
2011-09-23 00:15:31 +02:00
Andrew Bartlett
530e4cac2e s3-param Remove 'time offset' from smb.conf
This strange parameter is apparently very rarely used, and it seems to
me that on modern networks, if clients don't have correct clocks and
DST offsets, that many other things (Kerberos) start to fail pretty
quickly, and time and DST tables tend to be internet delivered anyway.

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sat Jun 11 03:54:45 CEST 2011 on sn-devel-104
2011-06-11 03:54:44 +02:00
Rusty Russell
0204ae6229 lib/util/time.c: timeval_current_ofs_usec
Several places want "microseconds from current time", and several were
simply handing "usecs" values which could be over a million.

Using a helper to do this is safer and more readable.

I didn't replace any obviously correct callers (ie. constants).

I also renamed wait_nsec in source3/lib/util_sock.c; it's actually
microseconds not nanoseconds (introduced with this code in Volker's
19b783cc Async wrapper for open_socket_out_send/recv).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-01 10:38:47 +02:00
Rusty Russell
56e72337b0 lib/util/time.c: timeval_current_ofs_msec
Several places want "milliseconds from current time", and several were
simply doing "msec * 1000" which can (and does in one place) result in
a usec value over 1 a million.

Using a helper to do this is safer and more readable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-01 10:38:47 +02:00
Andrew Bartlett
608c8e7872 lib/util/time: Merge time functions from source3/lib/time.c 2011-03-01 02:13:22 +01:00
Matthias Dieter Wallnöfer
07bcf6197d lib/util/time.c - make the "strftime" output locale independant ("%c" is not)
So that it also works on Solaris.
2010-12-22 12:21:16 +01:00
Volker Lendecke
301b60acc0 Fix a typo 2010-09-15 09:33:34 -07:00
Jeremy Allison
0b270f014f Ensure incoming timespec values correctly wrap at nsecs.
Jeremy.
2010-09-14 14:53:17 -07:00
Björn Jacke
b428952eef lib/util: add time_mono() for monotonic time a la time() 2010-09-07 20:29:13 +02:00
Björn Jacke
73ad77f20a lib/util: add nsec_time_diff to calulate diffs from timespecs 2010-08-31 10:26:23 +02:00
Björn Jacke
c091b3344b lib/util: add function to query the monotonic clock with the required fallback to the realtime clock 2010-08-31 10:25:03 +02:00
Björn Jacke
571ee54b79 lib/util: move TIME_T_MIN/MAX defines into header file 2010-01-07 00:50:29 +01:00
Jelmer Vernooij
ef80d1b794 Fix use of "time offset" parameter, and add test to make sure I don't break it again :-) 2008-12-23 22:10:34 +01:00
Jelmer Vernooij
cb78d4593b Cope with changed signature of http_timestring(). 2008-10-11 23:57:44 +02:00
Jelmer Vernooij
caa4e42860 Move lib/util from source4 to top-level libutil.
Conflicts:

	source4/Makefile
2008-10-11 21:05:38 +02:00