This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Add gettimeofday to posix package


Hi,

The following patch adds the gettimeofday(2) function to the posix
package and deletes the local implementations from the
ppp/snmp/microwindows packages. 

This patch depends on the sys/time.h -> isoinfra patch.

diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/compat/posix/current/ChangeLog packages/compat/posix/current/ChangeLog
--- /home/jacmet/ecos.orig/packages/compat/posix/current/ChangeLog	2005-01-07 23:02:41.000000000 +0100
+++ packages/compat/posix/current/ChangeLog	2005-01-07 22:42:54.000000000 +0100
@@ -1,3 +1,7 @@
+2005-01-07  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* src/time.cxx: Added gettimeofday function.
+
 2004-10-01  Oyvind Harboe  <oyvind.harboe@zylin.com>
 
 	* src/signal.cxx:  place the CYGBLD_ATTRIB_INIT_PRI such that it
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/compat/posix/current/src/time.cxx packages/compat/posix/current/src/time.cxx
--- /home/jacmet/ecos.orig/packages/compat/posix/current/src/time.cxx	2005-01-07 23:00:26.000000000 +0100
+++ packages/compat/posix/current/src/time.cxx	2005-01-07 20:58:17.000000000 +0100
@@ -61,12 +61,14 @@
 #include <pkgconf/kernel.h>
 
 #include <cyg/kernel/ktypes.h>          // base kernel types
+#include <cyg/kernel/kapi.h>
 #include <cyg/infra/cyg_trac.h>         // tracing macros
 #include <cyg/infra/cyg_ass.h>          // assertion macros
 
 #include "pprivate.h"                   // POSIX private header
 
 #include <time.h>                       // our header
+#include <sys/time.h>                   // gettimeofday
 
 #include <cyg/kernel/thread.hxx>
 #include <cyg/kernel/clock.hxx>
@@ -694,6 +696,16 @@
     TIME_RETURN(0);
 } 
 
+externC int gettimeofday( struct timeval *tv, struct timezone *tz )
+{
+    cyg_tick_count_t time = cyg_current_time();
+    
+    tv->tv_sec = time/CYGNUM_HAL_RTC_DENOMINATOR;
+    tv->tv_usec = (time%CYGNUM_HAL_RTC_DENOMINATOR)*10000;
+
+    return 0;
+}
+
 #endif // ifdef CYGPKG_POSIX_CLOCKS
 
 // -------------------------------------------------------------------------
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/isoinfra/current/ChangeLog packages/isoinfra/current/ChangeLog
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/isoinfra/current/include/sys/time.h packages/isoinfra/current/include/sys/time.h
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/ChangeLog
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/bsd_tcpip/current/include/sys/time.h packages/net/bsd_tcpip/current/include/sys/time.h
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/ppp/current/ChangeLog packages/net/ppp/current/ChangeLog
--- /home/jacmet/ecos.orig/packages/net/ppp/current/ChangeLog	2005-01-07 23:36:03.000000000 +0100
+++ packages/net/ppp/current/ChangeLog	2005-01-07 22:46:04.000000000 +0100
@@ -1,3 +1,9 @@
+2005-01-07  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* cdl/ppp.cdl: Depend on CYGPKG_POSIX, CYGPKG_POSIX_CLOCKS for
+	gettimeofday.
+	* src/sys-ecos.c: Remove local gettimeofday implemenation.
+
 2004-08-19  Oyvind Harboe <oyvind.harboe@zylin.com>
 2004-09-08  Andrew Lunn <andrew.lunn@ascom.ch>
 	
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/ppp/current/cdl/ppp.cdl packages/net/ppp/current/cdl/ppp.cdl
--- /home/jacmet/ecos.orig/packages/net/ppp/current/cdl/ppp.cdl	2005-01-07 23:36:03.000000000 +0100
+++ packages/net/ppp/current/cdl/ppp.cdl	2005-01-07 20:59:45.000000000 +0100
@@ -59,6 +59,9 @@
     requires      CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
     requires      CYGPKG_NET
     requires      CYGPKG_IO_SERIAL_FLOW_CONTROL
+
+    requires      CYGPKG_POSIX
+    requires      CYGPKG_POSIX_CLOCKS
     
     description "PPP support for eCos. This package contains the PPP
                  daemon functionality, BSD kernel device drivers for
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/ppp/current/src/sys-ecos.c packages/net/ppp/current/src/sys-ecos.c
--- /home/jacmet/ecos.orig/packages/net/ppp/current/src/sys-ecos.c	2005-01-07 23:36:05.000000000 +0100
+++ packages/net/ppp/current/src/sys-ecos.c	2005-01-07 21:00:13.000000000 +0100
@@ -1831,20 +1831,6 @@
 
 //=====================================================================
 
-int gettimeofday(struct timeval *tv, struct timezone *tz)
-{
-    cyg_tick_count_t time = cyg_current_time();
-    
-    tv->tv_sec = time/CYGNUM_HAL_RTC_DENOMINATOR;
-    tv->tv_usec = (time%CYGNUM_HAL_RTC_DENOMINATOR)*10000;
-    
-//    db_printf("%s: %d %d\n", __PRETTY_FUNCTION__, tv->tv_sec, tv->tv_usec);
-
-    return 0;
-}
-
-//=====================================================================
-
 char *crypt (const char *key, const char *salt)
 {
     static char res[13];
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/snmp/lib/current/ChangeLog packages/net/snmp/lib/current/ChangeLog
--- /home/jacmet/ecos.orig/packages/net/snmp/lib/current/ChangeLog	2005-01-07 23:37:19.000000000 +0100
+++ packages/net/snmp/lib/current/ChangeLog	2005-01-07 22:47:27.000000000 +0100
@@ -1,3 +1,9 @@
+2005-01-07  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* cdl/snmplib.cdl: Depend on CYGPKG_POSIX, CYGPKG_POSIX_CLOCKS for
+	gettimeofday.
+	* src/system.c: Remove local gettimeofday implemenation.
+
 2003-03-24  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/keytools.c (decode_keychange): Avoid undefined behaviour.
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/snmp/lib/current/cdl/snmplib.cdl packages/net/snmp/lib/current/cdl/snmplib.cdl
--- /home/jacmet/ecos.orig/packages/net/snmp/lib/current/cdl/snmplib.cdl	2005-01-07 23:37:19.000000000 +0100
+++ packages/net/snmp/lib/current/cdl/snmplib.cdl	2005-01-07 21:02:01.000000000 +0100
@@ -64,6 +64,9 @@
     requires      { 0 != CYGINT_ISO_ERRNO }
     requires      { 0 != CYGINT_ISO_ERRNO_CODES }
     requires      CYGPKG_NET
+    requires      CYGPKG_POSIX
+    requires      CYGPKG_POSIX_CLOCKS
+
     description   "SNMP protocol support library based on the UCD-SNMP project."
 
     compile					\
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/snmp/lib/current/src/system.c packages/net/snmp/lib/current/src/system.c
--- /home/jacmet/ecos.orig/packages/net/snmp/lib/current/src/system.c	2005-01-07 23:37:23.000000000 +0100
+++ packages/net/snmp/lib/current/src/system.c	2005-01-07 22:47:02.000000000 +0100
@@ -365,20 +365,6 @@
     return 1;
 }
 
-#ifndef HAVE_GETTIMEOFDAY
-
-int gettimeofday(struct timeval *tv,
-		 struct timezone *tz)
-{
-    struct _timeb timebuffer;
-
-    _ftime(&timebuffer);
-    tv->tv_usec = timebuffer.millitm * 1000;
-    tv->tv_sec = timebuffer.time;
-    return(0);
-}
-#endif	/* !HAVE_GETTIMEOFDAY */
-
 in_addr_t get_myaddr(void)
 {
   char local_host[130];
@@ -630,19 +616,6 @@
 }
 #endif // not __ECOS
 
-#ifndef HAVE_GETTIMEOFDAY
-
-int gettimeofday(struct timeval *tv,
-		 struct timezone *tz)
-{
-
-    tv->tv_usec = 0;
-    tv->tv_sec = time(NULL);
-    return(0);
-}
-#endif	/* !HAVE_GETTIMEOFDAY */
-
-
 #endif							/* ! WIN32 */
 /*******************************************************************/
 
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/tcpip/current/ChangeLog packages/net/tcpip/current/ChangeLog
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/net/tcpip/current/include/sys/time.h packages/net/tcpip/current/include/sys/time.h
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/services/gfx/mw/current/ChangeLog packages/services/gfx/mw/current/ChangeLog
--- /home/jacmet/ecos.orig/packages/services/gfx/mw/current/ChangeLog	2005-01-07 23:37:55.000000000 +0100
+++ packages/services/gfx/mw/current/ChangeLog	2005-01-07 22:49:18.000000000 +0100
@@ -1,3 +1,9 @@
+2005-01-07  Peter Korsgaard  <jacmet@sunsite.dk>
+
+	* cdl/microwindows.cdl: Depend on CYGPKG_POSIX_CLOCKS for
+	gettimeofday.
+	* src/ecos/ecos_app.c: Remove local gettimeofday implemenation.
+
 2004-06-08  Chris Garry <cgarry@sweeneydesign.co.uk>
 
         * src/ecos/ecos_app.c:  Remove 'strdup' definition.
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/services/gfx/mw/current/cdl/microwindows.cdl packages/services/gfx/mw/current/cdl/microwindows.cdl
--- /home/jacmet/ecos.orig/packages/services/gfx/mw/current/cdl/microwindows.cdl	2005-01-07 23:38:05.000000000 +0100
+++ packages/services/gfx/mw/current/cdl/microwindows.cdl	2005-01-07 22:47:53.000000000 +0100
@@ -52,7 +52,8 @@
 cdl_package CYGPKG_MICROWINDOWS {
     display       "MicroWindows"
     requires      CYGPKG_POSIX
-    requires      CYGPKG_ISOINFRA
+    requires      CYGPKG_POSIX_CLOCKS
+    requires      CYGPKG_ISOINFRA    
     requires      CYGINT_ISO_C_TIME_TYPES
     requires      CYGINT_ISO_STRERROR
     requires      CYGINT_ISO_ERRNO
diff -urN -x '*~' -x CVS /home/jacmet/ecos.orig/packages/services/gfx/mw/current/src/ecos/ecos_app.c packages/services/gfx/mw/current/src/ecos/ecos_app.c
--- /home/jacmet/ecos.orig/packages/services/gfx/mw/current/src/ecos/ecos_app.c	2005-01-07 23:38:13.000000000 +0100
+++ packages/services/gfx/mw/current/src/ecos/ecos_app.c	2005-01-07 21:06:10.000000000 +0100
@@ -60,15 +60,6 @@
 cyg_thread   startup_thread_obj;
 
 
-int 
-gettimeofday(struct timeval *tv,
-             struct timezone *tz)
-{
-    tv->tv_usec = 0;
-    tv->tv_sec = time(NULL);
-    return(0);
-}
-
 int
 strcasecmp(const char *s1, const char *s2)
 {
-- 
Bye, Peter Korsgaard

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]