]> andersk Git - gssapi-openssh.git/blobdiff - openssh/misc.c
merged OpenSSH 5.1p1 to trunk
[gssapi-openssh.git] / openssh / misc.c
index 3018bb144be7f1e5e85b3f86ea7aacadffbe31e0..22259846056930382a3f981ee3cdf52068fb6958 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.67 2008/01/01 08:47:04 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.69 2008/06/13 01:38:23 dtucker Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2005,2006 Damien Miller.  All rights reserved.
@@ -552,7 +552,7 @@ tilde_expand_filename(const char *filename, uid_t uid)
                if ((pw = getpwnam(user)) == NULL)
                        fatal("tilde_expand_filename: No such user %s", user);
        } else if ((pw = getpwuid(uid)) == NULL)        /* ~/path */
-               fatal("tilde_expand_filename: No such uid %d", uid);
+               fatal("tilde_expand_filename: No such uid %ld", (long)uid);
 
        if (strlcpy(ret, pw->pw_dir, sizeof(ret)) >= sizeof(ret))
                fatal("tilde_expand_filename: Path too long");
@@ -850,3 +850,23 @@ put_u16(void *vp, u_int16_t v)
        p[0] = (u_char)(v >> 8) & 0xff;
        p[1] = (u_char)v & 0xff;
 }
+
+void
+ms_subtract_diff(struct timeval *start, int *ms)
+{
+       struct timeval diff, finish;
+
+       gettimeofday(&finish, NULL);
+       timersub(&finish, start, &diff);        
+       *ms -= (diff.tv_sec * 1000) + (diff.tv_usec / 1000);
+}
+
+void
+ms_to_timeval(struct timeval *tv, int ms)
+{
+       if (ms < 0)
+               ms = 0;
+       tv->tv_sec = ms / 1000;
+       tv->tv_usec = (ms % 1000) * 1000;
+}
+
This page took 0.066342 seconds and 4 git commands to generate.