From: <ri...@us...> - 2004-01-20 21:43:08
|
Update of /cvsroot/gnucula/Gnucula/platform/opengcc In directory sc8-pr-cvs1:/tmp/cvs-serv9205/platform/opengcc Modified Files: opentime.cpp opentime.h strings.cpp strings.h typedefs.h Log Message: initial changes to bring up to date with gnucdnaR2. Index: opentime.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opentime.cpp 11 Jul 2003 18:52:49 -0000 1.2 --- opentime.cpp 20 Jan 2004 21:43:05 -0000 1.3 *************** *** 27,35 **** #ifdef LINUX #include <sys/time.h> ! // #include <isc/eventlib.h> ? #endif - - // #include <string> #include <errno.h> #include <signal.h> --- 27,33 ---- #ifdef LINUX #include <sys/time.h> ! // #include <isc/eventlib.h> // doc.s suggest... #endif #include <errno.h> #include <signal.h> *************** *** 43,52 **** #include "../../Conversions.h" ! #ifdef DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif /* ! * Function: current_time_string(char *) * * Description: Gets and returns the system time on a few systems. --- 41,50 ---- #include "../../Conversions.h" ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. #include "../../../console_interface/console_io.h" #endif /* ! * CHANGE ME! * * Description: Gets and returns the system time on a few systems. *************** *** 71,90 **** } ! Strings OpenTime::GetTZString(void) ! { ! OpenTime tempTime; ! tempTime.SetTime(GetTime()); ! ! Strings TZString = tempTime.Stringify("%Z"); ! return TZString; ! } ! timespec OpenTime::GetTime(void) { ! #ifdef DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In get"); #endif ! struct timespec CurrentEpochTime; ClockErrorCheck = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); // this uses errno, and may be unsafe with threading... --- 69,80 ---- } ! // semi-private functions timespec OpenTime::GetTime(void) { ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In get"); #endif ! struct ; ClockErrorCheck = clock_gettime(CLOCK_REALTIME, &CurrentEpochTime); // this uses errno, and may be unsafe with threading... *************** *** 95,104 **** void OpenTime::SetTime(timespec CurrentEpochTime) { ! #ifdef DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In set"); #endif FullTime = localtime(&(CurrentEpochTime.tv_sec)); ! return;// NewTime; } --- 85,96 ---- void OpenTime::SetTime(timespec CurrentEpochTime) { ! #ifdef CONSOLE_DEBUG // used for debugging. external to gnuc. Console_Output debug_io; debug_io.kwik_out("In set"); #endif FullTime = localtime(&(CurrentEpochTime.tv_sec)); ! TimeZone = Stringify("%Z"); ! TimeStamp = Stringify(); ! return; } *************** *** 107,111 **** // size_t string_length; Strings ReturnMe; ! if (ClockErrorCheck != 0) // something went wrong, return error { ReturnMe = "Clock Error: "; --- 99,103 ---- // size_t string_length; Strings ReturnMe; ! if (ClockErrorCheck != 0) // something is wrong, return error string instead { ReturnMe = "Clock Error: "; *************** *** 140,151 **** } // doesn't need to be internal... Strings OpenTime::CurrentTimeString(char *TimeStyle) { - OpenTime tempTime; Strings Current; - tempTime.SetTime(GetTime()); - if (ClockErrorCheck != 0) // something went wrong, return errno { --- 132,146 ---- } + Strings OpenTime::GetTZString(void) + { + Strings TZString = Stringify("%Z"); + return TZString; + } + // doesn't need to be internal... Strings OpenTime::CurrentTimeString(char *TimeStyle) { Strings Current; if (ClockErrorCheck != 0) // something went wrong, return errno { *************** *** 155,159 **** } ! Current = tempTime.Stringify(TimeStyle); return Current; --- 150,154 ---- } ! Current = Stringify(FullTime, TimeStyle); return Current; Index: opentime.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/opentime.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opentime.h 11 Jul 2003 18:52:49 -0000 1.2 --- opentime.h 20 Jan 2004 21:43:05 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- class Strings; + struct tm; struct timespec; *************** *** 39,53 **** private: int ClockErrorCheck; ! struct tm *FullTime; public: OpenTime(void); // function prototypes Strings CurrentTimeString(char * = "%Y-%m-%dT%H:%MZ"); Strings GetTZString(void); - timespec GetTime(void); - void SetTime(timespec); Strings Stringify(char * = "%Y-%m-%dT%H:%MZ"); ! // void start_timers( timer_t *, timer_t *); --- 40,59 ---- private: int ClockErrorCheck; ! tm *FullTime; ! Strings TimeStamp; ! Strings TimeZone; public: OpenTime(void); + // semi-private functions + timespec GetTime(void); + void SetTime(timespec); // function prototypes Strings CurrentTimeString(char * = "%Y-%m-%dT%H:%MZ"); Strings GetTZString(void); Strings Stringify(char * = "%Y-%m-%dT%H:%MZ"); ! bool IsSet(void); ! Strings GetStamp(void); ! void UpdateStamp(void); // void start_timers( timer_t *, timer_t *); Index: strings.cpp =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** strings.cpp 10 Jul 2003 22:41:07 -0000 1.7 --- strings.cpp 20 Jan 2004 21:43:05 -0000 1.8 *************** *** 3,7 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) --- 3,7 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall GCC extended code - Clayton Rollins (also LGPL) Index: strings.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/strings.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** strings.h 10 Jul 2003 22:41:07 -0000 1.10 --- strings.h 20 Jan 2004 21:43:05 -0000 1.11 *************** *** 32,42 **** #define STRINGS_H - //#include <stddef.h> - //using namespace std; // was for NULL - class Strings { private: int StringLength; // position of last null public: // for testing, gives console easy access, but is unneeded internal to gnuc. --- 32,41 ---- #define STRINGS_H class Strings { private: int StringLength; // position of last null + // add bool HasNull; + // test lengths to avoid overflows (where possible) public: // for testing, gives console easy access, but is unneeded internal to gnuc. Index: typedefs.h =================================================================== RCS file: /cvsroot/gnucula/Gnucula/platform/opengcc/typedefs.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** typedefs.h 10 Jul 2003 08:31:41 -0000 1.6 --- typedefs.h 20 Jan 2004 21:43:05 -0000 1.7 *************** *** 2,6 **** Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2003 John Marshall GCC extended code - Clayton Rollins (also LGPL) --- 2,6 ---- Gnucula - A Gnutella Library Based on GnucDNA ! Copyright (C) 2000-2004 John Marshall GCC extended code - Clayton Rollins (also LGPL) *************** *** 27,37 **** #ifndef TYPEDEFS_H ! #define TYPEDEFS_H ! ! //#include <iostream> ! //#include <string> ! //#include <sstream> ! #include <stddef.h> ! using namespace std; class Strings; // forward declaration --- 27,31 ---- #ifndef TYPEDEFS_H ! #define TYPEDEFS_H class Strings; // forward declaration |