[X2serv-cvs] [CVS] Module x3: Change committed
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2005-06-22 21:58:58
|
Committer : Alex Schumann <ru...@us...> CVSROOT : /cvsroot/x2serv Module : x3 Commit time: 2005-06-22 21:58:50 UTC Modified files: ChangeLog.X3 src/tools.c src/chanserv.help Log message: DURATION fixes ---------------------- diff included ---------------------- Index: x3/ChangeLog.X3 diff -u x3/ChangeLog.X3:1.39 x3/ChangeLog.X3:1.40 --- x3/ChangeLog.X3:1.39 Thu Jun 2 16:45:44 2005 +++ x3/ChangeLog.X3 Wed Jun 22 14:58:31 2005 @@ -1,6 +1,12 @@ /*********************************************************************** X3 ChangeLog +2005-06-22 Alex Schumann <ru...@af...> + * src/chanserv.help: Improved DURATION help + + * src/tools.c: Changed 'M' duration to 30 days (not 31) as its + a better average. + 2005-05-27 Alex Schumann <ru...@af...> * src/chanserv.c: Improved usability of register command, fixed @@ -252,5 +258,5 @@ ***********************************************************************/ -#define CVS_VERSION "$Revision: 1.39 $" +#define CVS_VERSION "$Revision: 1.40 $" Index: x3/src/chanserv.help diff -u x3/src/chanserv.help:1.18 x3/src/chanserv.help:1.19 --- x3/src/chanserv.help:1.18 Thu Jun 2 16:17:07 2005 +++ x3/src/chanserv.help Wed Jun 22 14:58:40 2005 @@ -280,11 +280,24 @@ "DOWNALL" ("/msg $C DOWNALL", "Executes the $bdown$b command for each channel you have access to.", "$uSee Also:$u down, up, upall"); -"DURATIONS" ("[<n>y][<n>M][<n>w][<n>d][<n>h][<n>m][<n>[s]]", - "There is a standard syntax for durations that let you easily specify longer periods of time. A duration consists of one or more \"duration parts\", which are sequences of digits, separated by duration letters.", - "The valid duration letters are $by$b (for year, or 365 days), $bM$b (for month, or 31 days), $bw$b (for week, or 7 days), $bd$b (for day, or 24 hours), $bh$b (for hour, or 60 minutes), $bm$b (for minute, or 60 seconds), and $bs$b (for second). We know not all years are 365 days and not all months are 31 days, but we pretend they are for parsing durations.", - "If the last duration part does not have any letter to indicate the units, seconds are assumed.", - "$uExamples$u: 1y1M is 365 days plus 31 days; 1y1m is 365 days plus 1 minute; 1h30m45 is ninety minutes and forty-five seconds; and so forth."); +"DURATIONS" ( + "This is the syntax used for commands that require time durations. A time duration is made up of numbers and units. Multiple units may be used in a row.", + "The valid unit letters are:", + "$by$b - years (365 days)", + "$bM$b - months (30 days)", + "$bw$b - weeks (7 days)", + "$bd$b - days (24 hours)", + "$bh$b - hours (60 minutes)", + "$bm$b - minutes (60 seconds)", + "$bs$b - seconds", + "If the unit letter is not givin, seconds are assumed.", + "$b$b", + "$uExamples$u:", + "$b5d$b is 5 days.", + "$b1y2M$b is 1 year and 2 months (425 days.)", + "$b1d1h$b is 1 day and 1 hour (25 hours.)", + "$b1h25m30s$b is 1 hour, 25 minutes and 30 seconds." + ); "EMOTE" ("/msg $C EMOTE <#channel> <text>", "Makes $b$C$b send a CTCP ACTION message to the specified channel.", "$uSee Also:$u say"); Index: x3/src/tools.c diff -u x3/src/tools.c:1.11 x3/src/tools.c:1.12 --- x3/src/tools.c:1.11 Sat Mar 19 17:11:35 2005 +++ x3/src/tools.c Wed Jun 22 14:58:35 2005 @@ -588,7 +588,7 @@ { switch (type) { case 'y': return 365*24*60*60; - case 'M': return 31*24*60*60; + case 'M': return 30*24*60*60; case 'w': return 7*24*60*60; case 'd': return 24*60*60; case 'h': return 60*60; @@ -598,6 +598,10 @@ } } +/* This function is not entirely accurate as it does not take into account leap units + * or varying months. TODO: use proper dateadd functions to calculate real seconds + * from now for the units (eg 1M should be give us seconds till todays date next month) + */ unsigned long ParseInterval(const char *interval) { ----------------------- End of diff ----------------------- |