Index: trunk/src/emx/include/InnoTekLIBC/backend.h
===================================================================
--- trunk/src/emx/include/InnoTekLIBC/backend.h	(revision 1901)
+++ trunk/src/emx/include/InnoTekLIBC/backend.h	(revision 1902)
@@ -792,4 +792,17 @@
 /** @} */
 
+
+/** @defgroup grp_Back_time  LIBC Backend - Time Management
+ * @{ */
+
+/**
+ * Gets the current high-resolution timestamp as nanoseconds.
+ *
+ * @returns nanosecond timestamp.
+ */
+hrtime_t __libc_Back_timeHighResNano(void);
+
+/** @} */
+
 __END_DECLS
 
Index: trunk/src/emx/include/sys/time.h
===================================================================
--- trunk/src/emx/include/sys/time.h	(revision 1901)
+++ trunk/src/emx/include/sys/time.h	(revision 1902)
@@ -40,4 +40,5 @@
  * @changed EMX isms
  * @changed IBM TCP paranoia.
+ * @changed Added hrtime_t and gethrtime from SUN/HP/RTLinux.
  * @todo    Implement futimes() and lutimes().
  */
@@ -333,4 +334,10 @@
 int	utimes(const char *, const struct timeval *);
 
+/* bird - start: A nice SUN/HP/RTLinux extension. */
+typedef signed long long hrtime_t;
+hrtime_t gethrtime(void);
+#define HRTIME_INFINITY     (0x7fffffffffffffffLL)
+/* bird - end. */
+
 __END_DECLS
 
Index: trunk/src/emx/src/lib/libc.def
===================================================================
--- trunk/src/emx/src/lib/libc.def	(revision 1901)
+++ trunk/src/emx/src/lib/libc.def	(revision 1902)
@@ -1486,2 +1486,4 @@
     "__std_wmemmove" @1494
     "__std_wmemset" @1495
+    "___libc_Back_timeHighResNano" @1496
+    "__std_gethrtime" @1497
Index: trunk/src/emx/src/lib/misc/gethrtime.c
===================================================================
--- trunk/src/emx/src/lib/misc/gethrtime.c	(revision 1902)
+++ trunk/src/emx/src/lib/misc/gethrtime.c	(revision 1902)
@@ -0,0 +1,46 @@
+/* $Id$ */
+/** @file
+ *
+ * LIBC - gethrtime().
+ *
+ * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
+ *
+ *
+ * This file is part of InnoTek LIBC.
+ *
+ * InnoTek LIBC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * InnoTek LIBC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with InnoTek LIBC; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "libc-alias.h"
+#include <sys/time.h>
+#include <InnoTekLIBC/backend.h>
+
+/**
+ * Get's get current high-resolution timer value as nanoseconds.
+ *
+ * @returns nanosecond timestamp.
+ *
+ * @remark SUN/HP/RTLinux extension, seems useful.
+ */
+hrtime_t _STD(gethrtime)(void)
+{
+    return __libc_Back_timeHighResNano();
+}
+
Index: trunk/src/emx/src/lib/sys/b_timeHighResNano.c
===================================================================
--- trunk/src/emx/src/lib/sys/b_timeHighResNano.c	(revision 1902)
+++ trunk/src/emx/src/lib/sys/b_timeHighResNano.c	(revision 1902)
@@ -0,0 +1,80 @@
+/* $Id$ */
+/** @file
+ *
+ * LIBC SYS Backend - gethrtime().
+ *
+ * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net>
+ *
+ *
+ * This file is part of InnoTek LIBC.
+ *
+ * InnoTek LIBC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * InnoTek LIBC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with InnoTek LIBC; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define  INCL_FSMACROS
+#define  INCL_BASE
+#include <os2emx.h>
+#include <InnoTekLIBC/backend.h>
+
+
+/**
+ * Gets the current high-resolution timestamp as nanoseconds.
+ *
+ * @returns nanosecond timestamp.
+ */
+hrtime_t __libc_Back_timeHighResNano(void)
+{
+    /*
+     * Calc factor the first time.
+     */
+    static ULONG        ulFreq;
+#ifdef USE_INTEGER
+    static unsigned     uMult;
+#endif
+    if (!ulFreq)
+    {
+        int rc = DosTmrQueryFreq(&ulFreq);
+        if (rc)
+            return HRTIME_INFINITY;
+#ifdef USE_INTEGER /* quick approximation, very assumpive. */
+        ulFreq  /=    1000;
+        uMult    = 1000000;
+#endif
+    }
+
+    /*
+     * Get time and recalc it to nanoseconds.
+     */
+    unsigned long long  ullCurrent = 0;
+    int rc = DosTmrQueryTime((void *)&ullCurrent);
+    if (!rc)
+#ifdef USE_INTEGER
+        return (ullCurrent * uMult) / ulFreq;
+#else
+    {
+        long double lrd = ullCurrent;
+        return lrd * 1000000000U / ulFreq;
+    }
+#endif
+
+    /* failure - should not happen! */
+    return HRTIME_INFINITY;
+}
+
