All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] implement grub_millisleep in util/misc.c for grub-emu
Date: Sun, 15 Feb 2009 19:49:38 +0100	[thread overview]
Message-ID: <1234723778.4746.7.camel@fz.local> (raw)

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

Here's a small patch which implements grub_millisleep () using nanosleep
() in util/misc.c.
I hope it's correct.

-- 
Felix Zielcke

[-- Attachment #2: millisleep.diff --]
[-- Type: text/x-patch, Size: 881 bytes --]

2009-02-15  Felix Zielcke  <fzielcke@z-51.de>

	* util/misc.c: Define _POSIX_C_SOURCE 199309L.
	Include <time.h>.
	(grub_millisleep): New function.

Index: util/misc.c
===================================================================
--- util/misc.c	(revision 1996)
+++ util/misc.c	(working copy)
@@ -27,6 +27,9 @@
 #include <sys/time.h>
 #include <unistd.h>
 
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+
 #include <grub/kernel.h>
 #include <grub/misc.h>
 #include <grub/cache.h>
@@ -310,6 +313,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)))

             reply	other threads:[~2009-02-15 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 18:49 Felix Zielcke [this message]
2009-02-21 23:25 ` [PATCH] implement grub_millisleep in util/misc.c for grub-emu Robert Millan
2009-02-28 20:51   ` Christian Franke
2009-02-28 20:56     ` Christian Franke
2009-03-04 10:26     ` Felix Zielcke
  -- strict thread matches above, loose matches on Subject: below --
2009-02-22  1:29 Kalamatee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1234723778.4746.7.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.