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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Time.pmod:9:   //! is inherited by other modules (<ref>ISO</ref> by <ref>YMD</ref>,   //! for instance).      #pike __REAL_VERSION__      // #pragma strict_types      //- these classes majorly works on seconds   //- an hour is 3600 seconds, a minute is 60 seconds    - import "."; - inherit TimeRanges:TimeRanges; + inherit .TimeRanges:TimeRanges;      #include "constants.h"      // from inherited module      function(mixed...:TimeRange) Day;      // sanity check      static private int __sanity_check=lambda()   {    if (5000000000!=5*inano)    error("Calendar.Time needs bignums (Gmp.mpz)\n");    return 1;   }();    - Rule.Timezone Timezone_UTC=Rule.Timezone(0,"UTC"); // needed for dumping + .Rule.Timezone Timezone_UTC=.Rule.Timezone(0,"UTC"); // needed for dumping      string calendar_name() { return "Time"; }      //------------------------------------------------------------------------   //! class TimeOfDay   //------------------------------------------------------------------------      class TimeofDay   {   //! inherits TimeRange
pike.git/lib/modules/Calendar.pmod/Time.pmod:76:    {    if (!sizeof(args))    {    rules=default_rules;    create_now();    return;    }    switch (args[0])    {    case "timeofday": -  rules=[object(Ruleset)]args[1]; +  rules=[object(.Ruleset)]args[1];    ux=[int]args[2];    len=[int]args[3];    ls=CALUNKNOWN;    return;       case "timeofday_sd": -  rules=[object(Ruleset)]args[1]; +  rules=[object(.Ruleset)]args[1];    ux=[int]args[2];    len=[int]args[3];    ls=[int]args[4];    utco=[int]args[5];    return;       default:    if (intp(args[0]) && sizeof(args)==1)    {    rules=default_rules;
pike.git/lib/modules/Calendar.pmod/Time.pmod:903:    left=this_object()->add(x,Day)->range(this_object()->end());    }    return sprintf("%s%d:%02d:%02d",    res,left->len/3600,    (left->len/60)%60,    left->len%60);    }      // --------    -  TimeofDay set_ruleset(Ruleset r) +  TimeofDay set_ruleset(.Ruleset r)    {    return    Second("timeofday",r,ux,len)    ->autopromote();    }       int utc_offset()    {    if (utco==CALUNKNOWN)    return [utco,tzn]=rules->timezone->tz_ux(ux),utco;
pike.git/lib/modules/Calendar.pmod/Time.pmod:1556:    void create(mixed ...args)    {    if (!sizeof(args))    {    rules=default_rules;    create_now();    return;    }    else if (args[0]=="timeofday_f")    { -  rules=[object(Ruleset)]args[1]; +  rules=[object(.Ruleset)]args[1];    ux=[int]args[2];    ns=[int]args[3];    len_s=[int]args[4];    len_ns=[int]args[5];    ls=CALUNKNOWN;       if (ns<0)    error("Can't create negative ns: %O\n",this_object());       if (!rules) error("no rules\n");
pike.git/lib/modules/Calendar.pmod/Time.pmod:1965:   //! as the called calendar but with another set of rules.   //!   //! Example:   //! <pre>   //! &gt; Calendar.now();   //! Result: Fraction(Fri 2 Jun 2000 18:03:22.010300 CET)   //! &gt; Calendar.set_timezone(Calendar.Timezone.UTC)->now();   //! Result: Fraction(Fri 2 Jun 2000 16:03:02.323912 UTC)   //! </pre>    - this_program set_timezone(string|Rule.Timezone tz) + this_program set_timezone(string|.Rule.Timezone tz)   {    return set_ruleset(default_rules->set_timezone(tz));   }    - Rule.Timezone timezone() + .Rule.Timezone timezone()   {    return default_rules->timezone;   }    - this_program set_language(string|Rule.Language lang) + this_program set_language(string|.Rule.Language lang)   {    return set_ruleset(default_rules->set_language(lang));   }    - Rule.Language language() + .Rule.Language language()   {    return default_rules->language;   }      //! method Calendar set_ruleset(Ruleset r)   //! method Ruleset ruleset()   //! Set or read the ruleset for the calendar.   //! <ref>set_ruleset</ref> returns a new calendar object,   //! but with the new ruleset.    - this_program set_ruleset(Ruleset r) + this_program set_ruleset(.Ruleset r)   { - // "this_program" here ceased to work -  object c=object_program(this_object())(); +  this_program c=this_program();    c->default_rules=r;    return c;   }    - Ruleset ruleset() + .Ruleset ruleset()   {    return default_rules;   }