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    - inherit .TimeRanges:TimeRanges; + inherit Calendar.TimeRanges:TimeRanges;      #include "constants.h"      // from inherited module      function(mixed...:TimeRange) Day;      // sanity check      #ifndef __AUTO_BIGNUM__   #error Calendar.Time needs bignums (Gmp.mpz)   #endif    - .Rule.Timezone Timezone_UTC=.Rule.Timezone(0,"UTC"); // needed for dumping + Calendar.Rule.Timezone Timezone_UTC= +  Calendar.Rule.Timezone(0,"UTC"); // needed for dumping      string calendar_name() { return "Time"; }      //------------------------------------------------------------------------   //! class TimeofDay   //! Virtual class used by e.g. Hour.   //------------------------------------------------------------------------      class TimeofDay   {
pike.git/lib/modules/Calendar.pmod/Time.pmod:73:    {    if (!sizeof(args))    {    rules=default_rules;    create_now();    return;    }    switch (args[0])    {    case "timeofday": -  rules=[object(.Ruleset)]args[1]; +  rules=[object(Calendar.Ruleset)]args[1];    ux=[int]args[2];    len=[int]args[3];    ls=CALUNKNOWN;    return;       case "timeofday_sd": -  rules=[object(.Ruleset)]args[1]; +  rules=[object(Calendar.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:941:    left=this->add(x,Day)->range(this->end());    }    return sprintf("%s%d:%02d:%02d",    res,left->len/3600,    (left->len/60)%60,    left->len%60);    }      // --------    -  this_program set_ruleset(.Ruleset r) +  this_program set_ruleset(Calendar.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:1628:    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(Calendar.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);       if (!rules) error("no rules\n");
pike.git/lib/modules/Calendar.pmod/Time.pmod:1658:    }    else if (intp(args[0]) && sizeof(args)==1)    {    rules=default_rules;    create_unixtime(args[0]);    return;    }    else switch (args[0])    {    case "timeofday": -  rules=[object(.Ruleset)]args[1]; +  rules=[object(Calendar.Ruleset)]args[1];    ux=[int]args[2];    len=[int]args[3];    ls=CALUNKNOWN;    ns=[int]args[4];    return;    case "unix":    rules=default_rules;    create_unixtime(@args[1..]);    return;    case "julian":
pike.git/lib/modules/Calendar.pmod/Time.pmod:1810:    }       TimeofDay autopromote()    {    if (!ns && !len_ns)    return Second("timeofday",rules,ux,len_s)->autopromote();       return this;    }    -  this_program set_ruleset(.Ruleset r) +  this_program set_ruleset(Calendar.Ruleset r)    {    return    Fraction("timeofday",r,ux,len,ns)    ->autopromote();    }       TimeofDay _move(int n,int z_s,void|int z_ns)    {    if ((z_s==0 && z_ns==0) || n==0) return autopromote();    int nns=ns+n*z_ns;
pike.git/lib/modules/Calendar.pmod/Time.pmod:2066:   //! 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|Calendar.Rule.Timezone tz)   {    return set_ruleset(default_rules->set_timezone(tz));   }    - .Rule.Timezone timezone() + Calendar.Rule.Timezone timezone()   {    return default_rules->timezone;   }    - this_program set_language(string|.Rule.Language lang) + this_program set_language(string|Calendar.Rule.Language lang)   {    return set_ruleset(default_rules->set_language(lang));   }    - .Rule.Language language() + Calendar.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(Calendar.Ruleset r)   {    this_program c=this_program();    c->default_rules=r;    return c;   }    - .Ruleset ruleset() + Calendar.Ruleset ruleset()   {    return default_rules;   }