X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=inline;f=bacula%2Fsrc%2Flib%2Fbtime.c;h=2901b27b11e035e3c0c160f2dc793deaac349496;hb=04ed7aa59b3c185e750b4d36260afa945612a497;hp=7487fe1c5a40b3435e75adaad12b4799a1c90e06;hpb=bb9f5a695c1ee8ec52a23b6cd8ab2628bd85f1e8;p=bacula%2Fbacula diff --git a/bacula/src/lib/btime.c b/bacula/src/lib/btime.c index 7487fe1c5a..2901b27b11 100644 --- a/bacula/src/lib/btime.c +++ b/bacula/src/lib/btime.c @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Bacula® is a registered trademark of John Walker. + Bacula® is a registered trademark of Kern Sibbald. The licensor of Bacula is the Free Software Foundation Europe (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. @@ -52,52 +52,52 @@ #include /* Formatted time for user display: dd-Mon-yyyy hh:mm */ -char *bstrftime(char *dt, int maxlen, utime_t tim) +char *bstrftime(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm); return dt; } /* Formatted time for user display: dd-Mon-yyyy hh:mm:ss */ -char *bstrftimes(char *dt, int maxlen, utime_t tim) +char *bstrftimes(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b-%Y %H:%M:%S", &tm); return dt; } /* Formatted time for user display: dd-Mon hh:mm */ -char *bstrftime_ny(char *dt, int maxlen, utime_t tim) +char *bstrftime_ny(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%d-%b %H:%M", &tm); return dt; } /* Formatted time for user display: dd-Mon-yy hh:mm (no century) */ -char *bstrftime_nc(char *dt, int maxlen, utime_t tim) +char *bstrftime_nc(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; char *p, *q; /* ***FIXME**** the format and localtime_r() should be user configurable */ - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); /* NOTE! since the compiler complains about %y, I use %y and cut the century */ strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm); /* overlay the century */ @@ -112,11 +112,11 @@ char *bstrftime_nc(char *dt, int maxlen, utime_t tim) /* Unix time to standard time string yyyy-mm-dd hh:mm:ss */ -char *bstrutime(char *dt, int maxlen, utime_t tim) +char *bstrutime(char *dt, int maxlen, utime_t utime) { - time_t ttime = (time_t)tim; + time_t time = (time_t)utime; struct tm tm; - (void)localtime_r(&ttime, &tm); + (void)localtime_r(&time, &tm); strftime(dt, maxlen, "%Y-%m-%d %H:%M:%S", &tm); return dt; } @@ -125,7 +125,7 @@ char *bstrutime(char *dt, int maxlen, utime_t tim) utime_t str_to_utime(char *str) { struct tm tm; - time_t ttime; + time_t time; /* Check for bad argument */ if (!str || *str == 0) { @@ -148,11 +148,11 @@ utime_t str_to_utime(char *str) } tm.tm_wday = tm.tm_yday = 0; tm.tm_isdst = -1; - ttime = mktime(&tm); - if (ttime == -1) { - ttime = 0; + time = mktime(&tm); + if (time == -1) { + time = 0; } - return (utime_t)ttime; + return (utime_t)time; } @@ -218,6 +218,7 @@ int tm_woy(time_t stime) int woy, fty, tm_yday; time_t time4; struct tm tm; + memset(&tm, 0, sizeof(struct tm)); (void)localtime_r(&stime, &tm); tm_yday = tm.tm_yday;