pike.git / lib / modules / Calendar.pmod / TimeRanges.pmod

version» Context lines:

pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1:   //! module Calendar    - // $Id: TimeRanges.pmod,v 1.22 2003/03/12 15:52:43 nilsson Exp $ + // $Id: TimeRanges.pmod,v 1.23 2003/03/13 02:18:43 nilsson Exp $      #pike __REAL_VERSION__      #define zero int(0..0)    - import "."; -  +    program SuperTimeRange=cSuperTimeRange;      string calendar_name() { return "TimeRanges"; }      object calendar_object=this_object();      string _sprintf(int t) { return (t=='O')?calendar_name():0; }    - Ruleset default_rules= -  master()->resolv("Calendar")["default_rules"]; + .Ruleset default_rules=Calendar.default_rules;      //------------------------------------------------------------------------   //! class TimeRange   //! This is the base class for any time measurement   //! and calendrar information. It defines all the   //! things you can do with a time range, any time   //! period.   //!   //! A TimeRange doubles as both a fixed period in   //! time, and an amount of time. For instance,
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:32:   //! ahead (unaligning it with the week period,   //! and thereby reducing it to just 7 days),   //! no matter when in time the actual day were.   //!   //------------------------------------------------------------------------      class TimeRange   {    constant is_timerange=1;    -  Ruleset rules; +  .Ruleset rules;      //! method void create("unix",int unixtime)   //! method void create("unix",int unixtime,int seconds_len)   //! Create the timerange from unix time (as given by   //! <tt>time(2)</tt>), with eventually the size of   //! the time range in the same unit, seconds.   //!   //! method void create("julian",int|float julian_day)   //! Create the timerange from a julian day, the   //! standardized method of counting days. If
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:882:    return res;    }      //! method TimeRange set_ruleset(Ruleset r)   //! method TimeRange ruleset(Ruleset r)   //! Set or get the current ruleset.   //! note:   //! this may include timezone shanges,   //! and change the time of day.    -  TimeRange set_ruleset(Ruleset r); -  Ruleset ruleset() +  TimeRange set_ruleset(.Ruleset r); +  .Ruleset ruleset()    {    return rules;    }      //! method TimeRange set_timezone(Timezone tz)   //! method TimeRange set_timezone(string tz)   //! method TimeZone timezone()   //! Set or get the current timezone (including dst) rule.   //!   //! note:   //! The time-of-day may very well   //! change when you change timezone.   //!   //! To get the time of day for a specified timezone,   //! select the timezone before getting the time of day:   //!   //! <tt>Year(2003)-&gt;...-&gt;set_timezone(TimeZone.CET)-&gt;...-&gt;hour(14)-&gt;...</tt>   //!    -  TimeRange set_timezone(string|Rule.Timezone tz) +  TimeRange set_timezone(string|.Rule.Timezone tz)    {    return set_ruleset(rules->set_timezone(tz));    }    -  Rule.Timezone timezone() +  .Rule.Timezone timezone()    {    return rules->timezone;    }      //! method TimeRange set_language(Rule.Language lang)   //! method TimeRange set_language(string lang)   //! method Language language()   //! Set or get the current language rule.    -  TimeRange set_language(string|Rule.Language lang) +  TimeRange set_language(string|.Rule.Language lang)    {    return set_ruleset(rules->set_language(lang));    }    -  Rule.Language language() +  .Rule.Language language()    {    return rules->language;    }      //! method Calendar calendar()   //! Simply gives back the calendar in use, for instance   //! Calendar.ISO or Calendar.Discordian.       object calendar()    {
pike.git/lib/modules/Calendar.pmod/TimeRanges.pmod:1146:    case 'O':    return "SuperTimeRange("+    map(parts,"_sprintf",'O')*", "+")";    case 't':    return "SuperTimeRange("+    map(parts,"_sprintf",'t')*", "+")";    }    return ::_sprintf(t,m);    }    -  TimeRange set_timezone(string|Rule.Timezone tz) +  TimeRange set_timezone(string|.Rule.Timezone tz)    {   // fixme?    return `|(@map(parts,"set_timezone",tz));    }   }      //! constant TimeRange nulltimerange   //! This represents the null time range,   //! which, to differ from the zero time range   //! (the zero-length time range), isn't placed