diff --git a/doc/sphinx_source/using/core.rst b/doc/sphinx_source/using/core.rst index c0ceb546b..262119ca9 100644 --- a/doc/sphinx_source/using/core.rst +++ b/doc/sphinx_source/using/core.rst @@ -1,4 +1,4 @@ -Last revised: August 29, 2023 +Last revised: October 2, 2025 ===================== Eggdrop Core Settings @@ -38,21 +38,15 @@ You can change the basic Eggdrop appearance and behavior in this section. This setting is used only for info to share with others on your botnet. Set this to the IRC network your bot is connected to. - set timezone "EST" - This setting defines which timezone is your bot in. It's used for internal - routines as well as for logfile timestamping and scripting purposes. - The timezone string specifies the name of the timezone and must be three - or more alphabetic characters. For example, Central European Time(UTC+1) - should be "CET". - - set offset "5" - The offset setting specifies the time value to be added to the local - time to get Coordinated Universal Time (UTC aka GMT). The offset is - positive if the local timezone is west of the Prime Meridian and - negative if it is east. The value (in hours) must be between -23 and - 23. For example, if the timezone is UTC+1, the offset is -1. - - set env(TZ) "$timezone $offset" (disabled by default) + set timezone "America/New_York" + This setting defines which timezone your bot is in. It's used for internal + routines as well as for logfile timestamping and scripting purposes. The + timezone string specifies an abbreviation for the timezone and must be three + or more alphabetic characters. For example, timezone "Europe/Berlin" + automatically adjusts for standard time and daylight saving time. See + https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#Time_zone_abbreviations. + + set env(TZ) "$timezone" (disabled by default) If you don't want to use the timezone setting for scripting purposes only, but instead everywhere possible, then use this setting. diff --git a/eggdrop.conf b/eggdrop.conf index bed1f7a5c..63e0a8376 100755 --- a/eggdrop.conf +++ b/eggdrop.conf @@ -32,23 +32,17 @@ set admin "Lamer " # Set this to the IRC network your bot is connected to. set network "I.didn't.edit.my.config.file.net" -# This setting defines which timezone is your bot in. It's used for internal -# routines as well as for logfile timestamping and scripting purposes. -# The timezone string specifies the name of the timezone and must be three -# or more alphabetic characters. For example, Central European Time(UTC+1) -# should be "CET". -set timezone "EST" - -# The offset setting specifies the time value to be added to the local -# time to get Coordinated Universal Time (UTC aka GMT). The offset is -# positive if the local timezone is west of the Prime Meridian and -# negative if it is east. The value (in hours) must be between -23 and -# 23. For example, if the timezone is UTC+1, the offset is -1. -set offset "5" +# This setting defines which timezone your bot is in. It's used for internal +# routines as well as for logfile timestamping and scripting purposes. The +# timezone string specifies an abbreviation for the timezone and must be three +# or more alphabetic characters. For example, timezone "Europe/Berlin" +# automatically adjusts for standard time and daylight saving time. See +# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#Time_zone_abbreviations. +set timezone "America/New_York" # If you don't want to use the timezone setting for scripting purposes only, # but instead everywhere possible, un-comment the following line. -#set env(TZ) "$timezone$offset" +#set env(TZ) "$timezone" ############################################################################ ## Network settings overview diff --git a/src/chanprog.c b/src/chanprog.c index 365f3a71e..dfd252611 100644 --- a/src/chanprog.c +++ b/src/chanprog.c @@ -39,7 +39,7 @@ extern char ver[], botnetnick[], firewall[], motdfile[], userfile[], helpdir[], extern time_t now, online_since; extern int backgrd, term_z, con_chan, cache_hit, cache_miss, firewallport, default_flags, max_logs, conmask, protect_readonly, make_userfile, - noshare, ignore_time, max_socks; + noshare, ignore_time, max_socks, now2_last; #ifdef TLS extern SSL_CTX *ssl_ctx; #endif @@ -400,6 +400,10 @@ void chanprog() if (!readtclprog(configfile)) fatal(MISC_NOCONFIGFILE, 0); + /* call localtime() to update timezone and reset misc.c:putlog() time cache */ + localtime(&now); + now2_last = 0; + for (i = 0; i < max_logs; i++) { if (logs[i].flags & LF_EXPIRING) { if (logs[i].filename != NULL) { diff --git a/src/misc.c b/src/misc.c index f5f2fe61c..f669c701f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -46,7 +46,7 @@ extern char helpdir[], version[], origbotname[], botname[], admin[], network[], extern int backgrd, con_chan, term_z, use_stderr, dcc_total, keep_all_logs; extern time_t now; -extern Tcl_Interp *interp; +time_t now2_last = 0; /* cache expensive localtime() */ char logfile_suffix[21] = ".%d%b%Y"; /* Format of logfile suffix */ char log_ts[33] = "[%H:%M:%S]"; /* Timestamp format for logfile entries */ @@ -516,7 +516,6 @@ void putlog (int type, char *chname, const char *format, ...) char s[LOGLINELEN], path[PATH_MAX], *out, ct[81], *s2, stamp[34]; va_list va; time_t now2 = time(NULL); - static time_t now2_last = 0; /* cache expensive localtime() */ static struct tm t; if (now2 != now2_last) {