]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-03-04 Felix Zielcke <fzielcke@z-51.de>
authorfzielcke <fzielcke@localhost>
Wed, 4 Mar 2009 10:25:31 +0000 (10:25 +0000)
committerfzielcke <fzielcke@localhost>
Wed, 4 Mar 2009 10:25:31 +0000 (10:25 +0000)
* util/misc.c: Include <time.h>.
(grub_millisleep): New function.

util/misc.c

index 559022ff19cb89ca66814d1f7f9ce6cbca626a90..8d7d0808b5804fcf2e55901d6859bfbb902ff28c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <unistd.h>
+#include <time.h>
 
 #include <grub/kernel.h>
 #include <grub/misc.h>
@@ -310,6 +311,16 @@ grub_get_time_ms (void)
   return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
 }
 
+void
+grub_millisleep (grub_uint32_t ms)
+{
+  struct timespec ts;
+
+  ts.tv_sec = ms / 1000;
+  ts.tv_nsec = (ms % 1000) * 1000000;
+  nanosleep (&ts, NULL);
+}
+
 void 
 grub_arch_sync_caches (void *address __attribute__ ((unused)),
                       grub_size_t len __attribute__ ((unused)))