]> jfr.im git - irc/evilnet/x3.git/commitdiff
DURATION fixes
authorrubin <redacted>
Wed, 22 Jun 2005 21:58:40 +0000 (21:58 +0000)
committerrubin <redacted>
Wed, 22 Jun 2005 21:58:40 +0000 (21:58 +0000)
ChangeLog.X3
src/chanserv.help
src/tools.c

index 9ceafd90dd4d8e68482d11b432b3061b3f22de7c..c6f9c7b7564105ce5d86733865976dff5c93f45f 100644 (file)
@@ -1,6 +1,12 @@
 /***********************************************************************
  X3 ChangeLog
 
+2005-06-22  Alex Schumann  <rubin@afternet.org>
+       * 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  <rubin@afternet.org>
 
        * src/chanserv.c: Improved usability of register command, fixed
index 92e301c7c00a6be0c06d1e7f890c8014e5a527c5..efb9d33912dc6815245b9c285ae78634ea620582 100644 (file)
 "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 a7782071cbd972ee4d274496336819943dd92148..946f27a5175b297c4527781d9420ec5a4ddbc770 100644 (file)
@@ -588,7 +588,7 @@ TypeLength(char type)
 {
     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 @@ TypeLength(char type)
     }
 }
 
+/* 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)
 {