[NeoStats-Devel] [Commits] r2726 - in trunk: include src
[email protected] Sun, 14 Aug 2005 06:18:55 +1000
| Newsgroups | gmane.comp.neostats.devel |
|---|---|
| Message-ID | <[email protected]> |
Author: Mark
Date: Sun Aug 14 04:18:52 2005
New Revision: 2726
Modified:
trunk/include/main.h
trunk/src/log.c
trunk/src/main.c
trunk/src/signals.c
trunk/src/sock.c
Log:
Tidy up me.now handling
Modified: trunk/include/main.h
==============================================================================
--- trunk/include/main.h (original)
+++ trunk/include/main.h Sun Aug 14 04:18:52 2005
@@ -42,5 +42,6 @@
}NS_EXIT_TYPE;
void do_exit( NS_EXIT_TYPE exitcode, char *quitmsg ) __attribute__( ( noreturn ) );
+void update_time_now( void );
#endif /* _MAIN_H_ */
Modified: trunk/src/log.c
==============================================================================
--- trunk/src/log.c (original)
+++ trunk/src/log.c Sun Aug 14 04:18:52 2005
@@ -127,8 +127,7 @@
static void make_log_timestring( void )
{
/* we update me.now here, because some functions might be busy and not call the loop a lot */
- me.now = time( NULL );
- ircsnprintf( me.strnow, STR_TIME_T_SIZE, "%lu", me.now );
+ update_time_now();
strftime( log_fmttime, TIMEBUFSIZE, "%d/%m/%Y[%H:%M:%S]", localtime( &me.now ) );
}
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Sun Aug 14 04:18:52 2005
@@ -90,6 +90,21 @@
static int attempts = 0;
jmp_buf sigvbuf;
+/** @brief update_time_now
+ *
+ * update the me.now struct entries
+ * NeoStats core use only.
+ *
+ * @param none
+ *
+ * @return none
+ */
+void update_time_now( void )
+{
+ me.now = time(NULL);
+ ircsnprintf (me.strnow, STR_TIME_T_SIZE, "%lu", (long)me.now);
+}
+
/** @brief get_options
*
* Processes command line options
@@ -173,8 +188,8 @@
/* our default lang is always -1 */
me.lang = -1;
me.numeric = 1;
- me.now = me.ts_boot = time( NULL );
- ircsnprintf( me.strnow, STR_TIME_T_SIZE, "%lu", ( long )me.now );
+ update_time_now();
+ me.ts_boot = me.now;
/* Clear config */
os_memset( &nsconfig, 0 , sizeof( config ) );
/* Default reconnect time */
Modified: trunk/src/signals.c
==============================================================================
--- trunk/src/signals.c (original)
+++ trunk/src/signals.c Sun Aug 14 04:18:52 2005
@@ -118,9 +118,7 @@
irc_globops( NULL, _( "Segmentation fault. Server terminating. Refer to segfault.log." ) );
nlog( LOG_CRITICAL, "Segmentation fault. Server terminating. Refer to segfault.log." );
}
-
- me.now = time(NULL);
- ircsnprintf (me.strnow, STR_TIME_T_SIZE, "%lu", me.now);
+ update_time_now();
strftime (segfault_fmttime, TIMEBUFSIZE, "%d/%m/%Y[%H:%M:%S]", localtime (&me.now));
os_fprintf( segfault, "------------------------SEGFAULT REPORT-------------------------\n" );
os_fprintf( segfault, "Please view the README for how to submit a bug report\n" );
Modified: trunk/src/sock.c
==============================================================================
--- trunk/src/sock.c (original)
+++ trunk/src/sock.c Sun Aug 14 04:18:52 2005
@@ -123,16 +123,6 @@
return s;
}
-/** @brief update the me.now struct
- * @param none
- * @return none
- */
-static void
-update_time() {
- me.now = time(NULL);
- ircsnprintf (me.strnow, STR_TIME_T_SIZE, "%lu", (long)me.now);
-}
-
#define CURLHACK 1
/** @brief main recv loop
*
@@ -157,7 +147,7 @@
me.lastmsg = me.now;
while (1) { /* loop till we get a error */
SET_SEGV_LOCATION();
- update_time();
+ update_time_now();
#if CURLHACK
event_loop(EVLOOP_ONCE);
#else