egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Eggdrop BUG in bind time?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
cerberus_gr
Halfop


Joined: 07 Feb 2003
Posts: 97
Location: 127.0.0.1

PostPosted: Sat Mar 19, 2005 1:16 am    Post subject: Eggdrop BUG in bind time? Reply with quote

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 Smile
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sat Mar 19, 2005 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
cerberus_gr
Halfop


Joined: 07 Feb 2003
Posts: 97
Location: 127.0.0.1

PostPosted: Sat Mar 19, 2005 1:49 am    Post subject: Reply with quote

Hmmm, I didn't know that!!! Embarassed Embarassed Embarassed

So, if if I want to get the "real" number of month i have to [expr {$month + 1}].

Thx Smile
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed May 17, 2006 6:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Wed May 17, 2006 9:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber