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

version» Context lines:

pike.git/lib/modules/Calendar.pmod/Stardate.pmod:1:   #pike __REAL_VERSION__      //! This implements TNG stardates.    - static constant TNGSTARPERJULIAN=1000.0/365.2425; - static constant TNGSTARPERSECOND=TNGSTARPERJULIAN/86400; - static constant TNG0JULIAN=2569518.5; - static constant TNG0UNIX=11139552000; + protected constant TNGSTARPERJULIAN=1000.0/365.2425; + protected constant TNGSTARPERSECOND=TNGSTARPERJULIAN/86400; + protected constant TNG0JULIAN=2569518.5; + protected constant TNG0UNIX=11139552000;      string calendar_name() { return "Stardate"; }      function(mixed...:cTick) Tick=cTick;      //!   class cTick   {    inherit Calendar.TimeRange;   
pike.git/lib/modules/Calendar.pmod/Stardate.pmod:66:    break;    case 0:    rules=Calendar.default_rules;    create_unixtime_default(time());    return;    }    rules=Calendar.default_rules;    ::create(@args);    }    -  static void create_unixtime(int unixtime,int seconds) +  protected void create_unixtime(int unixtime,int seconds)    {    t=(unixtime-TNG0UNIX)*TNGSTARPERSECOND;    len=seconds*TNGSTARPERSECOND;    }    -  static void create_unixtime_default(int unixtime) +  protected void create_unixtime_default(int unixtime)    {    t=(unixtime-TNG0UNIX)*TNGSTARPERSECOND;    len=0.0;    }    -  static void create_julian_day(int|float jd) +  protected void create_julian_day(int|float jd)    {    t=(jd-TNG0JULIAN)*TNGSTARPERJULIAN;    len=0.0;    }       //! This gives back the start of the stardate period,    //! as a float.    float tic()    {    return t;
pike.git/lib/modules/Calendar.pmod/Stardate.pmod:122:    int unix_time()    {    return ((int)(t/TNGSTARPERSECOND))+TNG0UNIX;    }       float julian_day()    {    return ((int)(t/TNGSTARPERJULIAN))+TNG0JULIAN;    }    -  static Calendar.TimeRange _add(int n,void|this_program step) +  protected Calendar.TimeRange _add(int n,void|this_program step)    {    float x;    if (!step)    x=len;    else    {    if (!step->is_stardate)    error("add: Incompatible type %O\n",step);    x=step->len;    }          if (n&&x)    return Tick("stardate",rules,t+x,len);    return this;    }    -  static void convert_from(Calendar.TimeRange other) +  protected void convert_from(Calendar.TimeRange other)    {    if (other->unix_time)    create_unixtime_default(other->unix_time());    else    ::convert_from(other);    if (other->is_stardate)    {    t=other->t;    len=other->len;    }    else if (other->number_of_seconds)    len=TNGSTARPERSECOND*other->number_of_seconds();    else if (other->number_of_days)    len=TNGSTARPERJULIAN*other->number_of_days();    else    len=0.0;    }    -  static Calendar.TimeRange _set_size(int n, Calendar.TimeRange x) +  protected Calendar.TimeRange _set_size(int n, Calendar.TimeRange x)    {    if (!x->is_stardate)    error("distance: Incompatible type %O\n",x);    return Tick("stardate",rules,t,x->len);    }       Calendar.TimeRange place(Calendar.TimeRange what,void|int force)    {   // can't do this    return this;