1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Misc time_t tweaks. %ld / (long)tv_sec -> %lld / (long long)tv_sec.

Eliminate unneeded casts. suggestions from & ok millert@ guenther@
This commit is contained in:
krw 2013-09-12 23:06:43 +00:00
parent 28f12acf62
commit b76d488763
7 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: timer.c,v 1.10 2009/10/27 23:59:24 deraadt Exp $ */
/* $OpenBSD: timer.c,v 1.11 2013/09/12 23:06:43 krw Exp $ */
/* $NetBSD: timer.c,v 1.3 1995/04/24 12:22:45 cgd Exp $ */
/*-
@ -109,6 +109,6 @@ delay(int tenths)
struct timeval duration;
duration.tv_usec = (tenths % 10 ) * 100000L;
duration.tv_sec = (long) (tenths / 10);
duration.tv_sec = tenths / 10;
select(0, 0, 0, 0, &duration);
}

View File

@ -268,9 +268,9 @@ main(int argc, char **argv)
gettimeofday(&tv2, NULL);
timevalsub(&tv2, &tv1);
printf("time %lu.%06lu\n",
(unsigned long)tv2.tv_sec,
(unsigned long)tv2.tv_usec);
printf("time %lld.%06ld\n",
(long long)tv2.tv_sec,
tv2.tv_usec);
BN_free(e);
ENGINE_finish(engine);
@ -310,9 +310,9 @@ main(int argc, char **argv)
timevalsub(&tv2, &tv1);
printf("time %lu.%06lu\n",
(unsigned long)tv2.tv_sec,
(unsigned long)tv2.tv_usec);
printf("time %lld.%06ld\n",
(long long)tv2.tv_sec,
tv2.tv_usec);
RSA_free(rsa);
ENGINE_finish(engine);

View File

@ -77,9 +77,9 @@ time_encryption(krb5_context context, size_t size,
timevalsub(&tv2, &tv1);
printf("%s size: %7lu iterations: %d time: %3ld.%06ld\n",
printf("%s size: %7lu iterations: %d time: %3lld.%06ld\n",
etype_name, (unsigned long)size, iterations,
(long)tv2.tv_sec, (long)tv2.tv_usec);
(long long)tv2.tv_sec, tv2.tv_usec);
free(buf);
free(etype_name);
@ -122,8 +122,8 @@ time_s2k(krb5_context context,
timevalsub(&tv2, &tv1);
printf("%s string2key %d iterations time: %3ld.%06ld\n",
etype_name, iterations, (long)tv2.tv_sec, (long)tv2.tv_usec);
printf("%s string2key %d iterations time: %3lld.%06ld\n",
etype_name, iterations, (long long)tv2.tv_sec, tv2.tv_usec);
free(etype_name);
}

View File

@ -77,9 +77,9 @@ time_encryption(krb5_context context, size_t size,
timevalsub(&tv2, &tv1);
printf("%s size: %7lu iterations: %d time: %3ld.%06ld\n",
printf("%s size: %7lu iterations: %d time: %3lld.%06ld\n",
etype_name, (unsigned long)size, iterations,
(long)tv2.tv_sec, (long)tv2.tv_usec);
(long long)tv2.tv_sec, tv2.tv_usec);
free(buf);
free(etype_name);
@ -122,8 +122,8 @@ time_s2k(krb5_context context,
timevalsub(&tv2, &tv1);
printf("%s string2key %d iterations time: %3ld.%06ld\n",
etype_name, iterations, (long)tv2.tv_sec, (long)tv2.tv_usec);
printf("%s string2key %d iterations time: %3lld.%06ld\n",
etype_name, iterations, (long long)tv2.tv_sec, tv2.tv_usec);
free(etype_name);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: itimer.c,v 1.1 2004/07/28 21:32:51 art Exp $ */
/* $OpenBSD: itimer.c,v 1.2 2013/09/12 23:06:44 krw Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org> 2004 Public Domain.
*/
@ -82,8 +82,8 @@ main(int argc, char **argv)
timersub(&stv, &tv, &tv);
if (tv.tv_sec != 0 || tv.tv_usec > 100000)
errx(1, "timer difference too big: %ld.%ld", (long)tv.tv_sec,
(long)tv.tv_usec);
errx(1, "timer difference too big: %lld.%ld",
(long long)tv.tv_sec, tv.tv_usec);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ping.c,v 1.94 2013/04/16 22:10:34 deraadt Exp $ */
/* $OpenBSD: ping.c,v 1.95 2013/09/12 23:06:44 krw Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
@ -347,7 +347,7 @@ main(int argc, char *argv[])
memset(&interstr, 0, sizeof(interstr));
interstr.it_value.tv_sec = (long) interval;
interstr.it_value.tv_sec = interval;
interstr.it_value.tv_usec =
(long) ((interval - interstr.it_value.tv_sec) * 1000000);

View File

@ -449,10 +449,10 @@ lwres_context_sendrecv(lwres_context_t *ctx,
struct timeval timeout;
/*
* Type of tv_sec is 32 bits long.
* Type of tv_sec is at least 32 bits long.
*/
if (ctx->timeout <= 0x7FFFFFFFU)
timeout.tv_sec = (int)ctx->timeout;
timeout.tv_sec = ctx->timeout;
else
timeout.tv_sec = 0x7FFFFFFF;