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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Time.pmod:697:   //! method string format_month_short();   //! method string format_iso_time();   //! method string format_time();   //! method string format_time_short();   //! method string format_time_xshort();   //! method string format_mtime();   //! method string format_xtime();   //! method string format_tod();   //! method string format_xtod();   //! method string format_mod(); + //! method string format_nice(); + //! method string format_nicez();   //! Format the object into nice strings;   //! <pre>   //! iso_ymd "2000-06-02 (Jun) -W22-5 (Fri)" [2]   //! ext_ymd "Friday, 2 June 2000" [2]   //! ymd "2000-06-02"   //! ymd_short "20000602"   //! ymd_xshort "000602" [1]   //! iso_week "2000-W22"   //! iso_week_short "2000W22"   //! week "2000-w22" [2]   //! week_short "2000w22" [2]   //! month "2000-06"   //! month_short "200006" [1]   //! iso_time "2000-06-02 (Jun) -W22-5 (Fri) 20:53:14 UTC+1" [2]   //! ext_time "Friday, 2 June 2000, 20:53:14" [2]   //! ctime "Fri Jun 4 20:53:14 2000\n" [2] [3] - //! http "Fri, 02 Jun 2000 20:53:14 GMT" [4] + //! http "Fri, 02 Jun 2000 19:53:14 GMT" [4]   //! time "2000-06-02 20:53:14"   //! time_short "20000602 20:53:14"   //! time_xshort "000602 20:53:14"   //! mtime "2000-06-02 20:53"   //! xtime "2000-06-02 20:53:14.000000"   //! todz "20:53:14 CET"   //! todz_iso "20:53:14 UTC+1"   //! tod "20:53:14"   //! tod_short "205314"   //! xtod "20:53:14.000000"   //! mod "20:53" -  + //! nice "2 Jun 20:53", "2 Jun 2000 20:53:14" [2][5] + //! nicez "2 Jun 20:53 CET" [2][5] + //! smtp "Fri, 2 Jun 2000 20:53:14 +0100" [6]   //! </pre>   //! <tt>[1]</tt> note conflict (think 1 February 2003)   //! <br><tt>[2]</tt> language dependent   //! <br><tt>[3]</tt> as from the libc function ctime()   //! <br><tt>[4]</tt> as specified by the HTTP standard; - //! this is always in GMT, ie, UTC. The timezone calculations - //! needed will be executed implicitly. It is not language - //! dependent. + //! this is always in GMT, ie, UTC. The timezone calculations + //! needed will be executed implicitly. It is not language + //! dependent. + //! <br><tt>[5]</tt> adaptive to type and with special cases + //! for yesterday, tomorrow and other years + //! <br><tt>[6]</tt> as seen in Date: headers in mails       string format_ext_ymd();    string format_iso_ymd();    string format_ymd();    string format_ymd_short();    string format_ymd_xshort();    string format_iso_week();    string format_iso_week_short();    string format_week();    string format_week_short();    string format_month();    string format_month_short();    -  +  string format_nice(); +     string format_iso_time()    {    return this_object()->format_iso_ymd()+" "+format_todz_iso();    }       string format_ext_time()    {    return this_object()->format_ext_ymd()+" "+format_tod();    }   
pike.git/lib/modules/Calendar.pmod/Time.pmod:846:    string format_xtod()    {    if (ls==CALUNKNOWN) make_local();    return sprintf("%02d:%02d:%02d.%06d",    ls/3600,    (ls/60)%60,    ls%60,    0);    }    +  string format_nice(); +  string format_nicez() +  { +  return format_nice()+" "+tzname(); +  } +  +  string format_smtp() +  { +  if (ls==CALUNKNOWN) make_local(); +  int u=utc_offset(); +  return sprintf("%s, %s %s %s %d:%02d:%02d %+03d%02d", +  base->week_day_name(), +  base->month_day_name(), +  base->month_shortname(), +  base->year_name(), +  ls/3600, (ls/60)%60, ls%60, +  -u/3600,max(u,-u)/60%60); +  } +     string format_elapsed()    {    string res="";    object left=this_object();    int x;    if ( (x=(this_object()/Day)) )    {    res+=sprintf("%dd",x);    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)    {    return    Second("timeofday",r,ux,len)    ->autopromote();    }       int utc_offset()
pike.git/lib/modules/Calendar.pmod/Time.pmod:1190:    }    })    return "error";    }       string nice_print()    {    if (ls==CALUNKNOWN) make_local();    return sprintf("%d:00 %s",ls/3600,tzname());    } +  +  string format_nice() +  { +  if (ls==CALUNKNOWN) make_local(); +  if (!base) make_base(); +  return base->format_nice()+" "+sprintf("%d:00",ls/3600);    } -  + }      //------------------------------------------------------------------------   //! class Minute   //------------------------------------------------------------------------      function(mixed...:cMinute) Minute=cMinute; // inheritance purposes   class cMinute   {    constant is_minute=1;   
pike.git/lib/modules/Calendar.pmod/Time.pmod:1258:    default:    return 0;    }    }       string nice_print()    {    if (ls==CALUNKNOWN) make_local();    return sprintf("%d:%02d %s",ls/3600,(ls/60)%60,tzname());    } +  +  string format_nice() +  { +  if (ls==CALUNKNOWN) make_local(); +  if (!base) make_base(); +  return base->format_nice()+" "+sprintf("%d:%02d",ls/3600,(ls/60)%60);    } -  + }      //------------------------------------------------------------------------   //! class Second   //------------------------------------------------------------------------      function(mixed...:cSecond) Second=cSecond; // inheritance purposes   class cSecond   {    constant is_second=1;   
pike.git/lib/modules/Calendar.pmod/Time.pmod:1326:    return 0;    }    }       string nice_print()    {    if (ls==CALUNKNOWN) make_local();    return sprintf("%d:%02d:%02d %s",ls/3600,ls/60%60,ls%60,tzname());    }    +  string format_nice() +  { +  if (ls==CALUNKNOWN) make_local(); +  if (!base) make_base(); +  return base->format_nice()+" "+ +  sprintf("%d:%02d:%02d",ls/3600,ls/60%60,ls%60); +  } +    // backwards compatible with calendar I    string iso_name()    { return this_object()->format_ymd()+" T"+format_tod(); }    string iso_short_name()    { return this_object()->format_ymd_short()+" T"+(format_tod()-":"); }   }      //------------------------------------------------------------------------   //! class Fraction   //! A Fraction is a part of a second, and/or a time period
pike.git/lib/modules/Calendar.pmod/Time.pmod:1546:       int __hash() { return ux; }       string nice_print()    {    if (ls==CALUNKNOWN) make_local();    return sprintf("%d:%02d:%02d.%06d %s",    ls/3600,ls/60%60,ls%60,ns/1000,tzname());    }    +  string format_nice() +  { +  if (ls==CALUNKNOWN) make_local(); +  if (!base) make_base(); +  return base->format_nice()+" "+ +  sprintf("%d:%02d:%02d.%06d", +  ls/3600,ls/60%60,ls%60,ns/1000); +  } +     TimeofDay autopromote()    {    if (!ns && !len_ns)    return Second("timeofday",rules,ux,len_s)->autopromote();       return this_object();    }       TimeofDay _move(int n,int z_s,void|int z_ns)    {