| View previous topic :: View next topic |
| Author |
Message |
cerberus_gr Halfop
Joined: 07 Feb 2003 Posts: 97 Location: 127.0.0.1
|
Posted: Sat Mar 19, 2005 1:16 am Post subject: Eggdrop BUG in bind time? |
|
|
Just look the following code and correct me if I'm wrong.
_geo_ is me and CerberuS is my eggdrop (1.6.17)
| Code: |
[07:09:44] <_geo_> .tcl proc chktime { min hour day month year } { putlog "$min - $hour - $day - $month - $year" }
[07:09:44] <CerberuS> Tcl:
[07:12:02] <_geo_> .tcl putlog [clock format [clock seconds] -format "%c"]
[07:12:02] <CerberuS> [07:11:29] Sat 19 Mar 2005 07:11:29 AM EET
[07:12:03] <CerberuS> Tcl:
[07:12:26] <_geo_> .tcl bind time - "12 07 * * *" chktime
[07:12:26] <CerberuS> Tcl: 12 07 * * *
[07:12:33] <CerberuS> [07:12:00] 12 - 07 - 19 - 02 - 2005
|
Also date command for my shell is:
| Code: |
-bash-2.05b$ date
Sat Mar 19 07:16:13 EET 2005
|
As you can see the month is March, which is 3rd, but when the time bind calls the chktime procedure the month which returns is 02.
Why this happens?
Thx  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sat Mar 19, 2005 1:46 am Post subject: |
|
|
this is not a bug
eggdrop gets the time via standard library time functions, which utilize struct tm; that struct has the following members:
| Code: |
int tm_sec; /* seconds (0 - 60) */
int tm_min; /* minutes (0 - 59) */
int tm_hour; /* hours (0 - 23) */
int tm_mday; /* day of month (1 - 31) */
int tm_mon; /* month of year (0 - 11) */
int tm_year; /* year - 1900 */
int tm_wday; /* day of week (Sunday = 0) */
int tm_yday; /* day of year (0 - 365) */
int tm_isdst; /* is summer time in effect? */
char *tm_zone; /* abbreviation of timezone name */
long tm_gmtoff; /* offset from UTC in seconds */
|
as you can see, months are zero-base indexed |
|
| Back to top |
|
 |
cerberus_gr Halfop
Joined: 07 Feb 2003 Posts: 97 Location: 127.0.0.1
|
Posted: Sat Mar 19, 2005 1:49 am Post subject: |
|
|
Hmmm, I didn't know that!!!
So, if if I want to get the "real" number of month i have to [expr {$month + 1}].
Thx  |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed May 17, 2006 6:42 pm Post subject: |
|
|
| demond wrote: | this is not a bug
eggdrop gets the time via standard library time functions, which utilize struct tm; that struct has the following members:
| Code: |
int tm_sec; /* seconds (0 - 60) */
int tm_min; /* minutes (0 - 59) */
int tm_hour; /* hours (0 - 23) */
int tm_mday; /* day of month (1 - 31) */
int tm_mon; /* month of year (0 - 11) */
int tm_year; /* year - 1900 */
int tm_wday; /* day of week (Sunday = 0) */
int tm_yday; /* day of year (0 - 365) */
int tm_isdst; /* is summer time in effect? */
char *tm_zone; /* abbreviation of timezone name */
long tm_gmtoff; /* offset from UTC in seconds */
|
as you can see, months are zero-base indexed |
::bump::
Maybe this should be noted in the tcl-command.doc, cos that file says digits are "exactly two-characterss long" :/ |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Wed May 17, 2006 9:37 pm Post subject: |
|
|
| rosc2112 wrote: |
::bump::
Maybe this should be noted in the tcl-command.doc, cos that file says digits are "exactly two-characterss long" :/ |
Eggdrop docs assume the user has the basic knowledge of unix-like operating systems to know that the first number in any count is 0.
With this knowledge, and the statement that digits require two characters, January is month 00. |
|
| Back to top |
|
 |
|