- 29 5月, 2014 1 次提交
-
-
由 Laine Stump 提交于
The original version of virTimeLocalOffsetFromUTC() would fail for certain times of the day if daylight savings time was active. This could most easily be seen by uncommenting the TEST_LOCALOFFSET() cases that include a DST setting. After a lot of experimenting, I found that the way to solve it in almost all test cases is to set tm_isdst = -1 in the struct tm prior to calling mktime(). Once this is done, the correct offset is returned for all test cases at all times except the two hours just after 00:00:00 Jan 1 UTC - during that time, any timezone that is *behind* UTC, and that is supposed to always be in DST will not have DST accounted for in its offset. I believe that the code of virTimeLocalOffsetFromUTC() actually is correct for all cases, but the problem still encountered is due to our inability to come up with a TZ string that properly forces DST to *always* be active. Since a modfication of the (currently fixed) expected result data to account for this would necessarily use the same functions that we're trying to test, I've instead just made the test program conditionally bypass the problematic cases if the current date is either December 31 or January 1. This way we get maximum testing during 363 days of the year, but don't get false failures on Dec 31 and Jan 1.
-
- 26 5月, 2014 1 次提交
-
-
由 Laine Stump 提交于
Since there isn't a single libc API to get this value, this patch supplies one which gets the value by grabbing current time, then converting that into a struct tm with gmtime_r(), then back to a time_t using mktime. The returned value is the difference between UTC and localtime in seconds. If localtime is ahead of UTC (east) the offset will be a positive number, and if localtime is behind UTC (west) the offset will be negative. This function should be POSIX-compliant, and is threadsafe, but not async signal safe. If it was ever necessary to know this value in a child process, we could cache it with a one-time init function when libvirtd starts, then just supply the cached value, but that complexity isn't needed for current usage; that would also have the problem that it might not be accurate after a local daylight savings boundary. (If it weren't for DST, we could simply replace this entire function with "-timezone"; timezone contains the offset of the current timezone (negated from what we want) but doesn't account for DST. And in spite of being guaranteed by POSIX, it isn't available on older versions of mingw.) Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 10 7月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
-
- 02 5月, 2013 1 次提交
-
-
由 Michal Privoznik 提交于
The source code base needs to be adapted as well. Some files include virutil.h just for the string related functions (here, the include is substituted to match the new file), some include virutil.h without any need (here, the include is removed), and some require both.
-
- 21 12月, 2012 3 次提交
-
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
由 Daniel P. Berrange 提交于
-
- 02 11月, 2012 1 次提交
-
-
由 Daniel P. Berrange 提交于
The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 21 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
https://www.gnu.org/licenses/gpl-howto.html recommends that the 'If not, see <url>.' phrase be a separate sentence. * tests/securityselinuxhelper.c: Remove doubled line. * tests/securityselinuxtest.c: Likewise. * globally: s/; If/. If/
-
- 05 9月, 2012 1 次提交
-
-
由 Eric Blake 提交于
On OpenBSD, clock_gettime() exists in libc rather than librt, and blindly linking with -lrt made the build fail. Gnulib already did the work for determining which libraries to use, so we should reuse that work rather than doing it ourselves. * bootstrap.conf (gnulib_modules): Pull in clock-time. * configure.ac (RT_LIBS): Drop. * src/Makefile.am (libvirt_util_la_LIBADD): Use gnulib variable instead. * src/util/virtime.c (includes): Simplify.
-
- 23 7月, 2012 1 次提交
-
-
由 Osier Yang 提交于
Per the FSF address could be changed from time to time, and GNU recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html) You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. This patch removes the explicit FSF address, and uses above instead (of course, with inserting 'Lesser' before 'General'). Except a bunch of files for security driver, all others are changed automatically, the copyright for securify files are not complete, that's why to do it manually: src/security/security_selinux.h src/security/security_driver.h src/security/security_selinux.c src/security/security_apparmor.h src/security/security_apparmor.c src/security/security_driver.c
-
- 01 12月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
The glibc time.h header has an undocumented __isleap macro that we are using. Since it is undocumented & does not appear on any other OS, stop using it and just define the macro in libvirt code instead. * src/util/virtime.c: Remove __isleap usage
-
- 30 11月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
The logging APIs need to be able to generate formatted timestamps using only async signal safe functions. This rules out using gmtime/localtime/malloc/gettimeday(!) and much more. Introduce a new internal API which is async signal safe. virTimeMillisNowRaw replacement for gettimeofday. Uses clock_gettime where available, otherwise falls back to the unsafe gettimeofday virTimeFieldsNowRaw replacements for gmtime(), convert a timestamp virTimeFieldsThenRaw into a broken out set of fields. No localtime() replacement is provided, because converting to local time is not practical with only async signal safe APIs. virTimeStringNowRaw replacements for strftime() which print a timestamp virTimeStringThenRaw into a string, using a pre-determined format, with a fixed size buffer (VIR_TIME_STRING_BUFLEN) For each of these there is also a version without the Raw postfix which raises a full libvirt error. These versions are not async signal safe * src/Makefile.am, src/util/virtime.c, src/util/virtime.h: New files * src/libvirt_private.syms: New APis * configure.ac: Check for clock_gettime in -lrt * tests/virtimetest.c, tests/Makefile.am: Test new APIs
-