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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Time.pmod:32:    if (5000000000!=5*inano)    error("Calendar.Time needs bignums (Gmp.mpz)\n");    return 1;   }();      Ruleset.Timezone Timezone_UTC=Ruleset()->Timezone(0,"UTC"); // needed for dumping      string calendar_name() { return "Time"; }      //------------------------------------------------------------------------ - //! class TimeOfDay + //! class TimeofDay   //------------------------------------------------------------------------      class TimeofDay   {   //! inherits TimeRange    inherit TimeRange;       constant is_timeofday=1;       TimeRange base; // base day
pike.git/lib/modules/Calendar.pmod/Time.pmod:1585:    return;    }    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]; +  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":    rules=default_rules;    create_julian_day(args[1]);    return;    case "unix_r":    rules=args[-1];
pike.git/lib/modules/Calendar.pmod/Time.pmod:1731:    }       TimeofDay autopromote()    {    if (!ns && !len_ns)    return Second("timeofday",rules,ux,len_s)->autopromote();       return this_object();    }    +  TimeofDay set_ruleset(.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;    int nux=ux+n*z_s;    if (nns<0 || nns>=inano) nux+=nns/inano,nns%=inano;    return Fraction("timeofday_f",rules,nux,nns,len_s,len_ns)    ->autopromote();    }   
pike.git/lib/modules/Calendar.pmod/Time.pmod:1935:    len_s/3600,(len_s/60)%60,    len_s%60,len_ns/1000000);    if (len_s>=60)    return sprintf("%d:%02d.%03d",    len_s/60,len_s%60,len_ns/1000000);    if (len_s || len_ns>inano/1000)    return sprintf("%d.%06d",    len_s,len_ns/1000);    return sprintf("0.%09d",len_ns);    } +  +  float fraction_no() +  { +  return ns / 1e9;    } -  + }      //------------------------------------------------------------------------   // global convinience functions   //------------------------------------------------------------------------      //! method TimeofDay now()   //! Give the zero-length time period of the   //! current time.      TimeofDay now()