Branch: Tag:

2003-03-13

2003-03-13 02:18:43 by Martin Nilsson <mani@lysator.liu.se>

No imports. Autodoced.

Rev: lib/modules/Calendar.pmod/Gregorian.pmod:1.8
Rev: lib/modules/Calendar.pmod/ISO.pmod:1.8
Rev: lib/modules/Calendar.pmod/Islamic.pmod:1.8
Rev: lib/modules/Calendar.pmod/Julian.pmod:1.9
Rev: lib/modules/Calendar.pmod/Stardate.pmod:1.10
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.7
Rev: lib/modules/Calendar.pmod/Time.pmod:1.24
Rev: lib/modules/Calendar.pmod/TimeRanges.pmod:1.23
Rev: lib/modules/Calendar.pmod/YMD.pike:1.2

1: - //! module Calendar - //! submodule Stardate - //! This implements TNG stardates. -  +    #pike __REAL_VERSION__    -  + //! This implements TNG stardates. +    inherit .TimeRanges;      static constant TNGSTARPERJULIAN=1000.0/365.2425;
14:   string calendar_name() { return "Stardate"; }      function(mixed...:cTick) Tick=cTick; +  + //!   class cTick   {    inherit TimeRange;
23:    float t;    float len;    - //! method void create(mixed ...) - //! method void create(int|float date) - //! method void create() +  //! @decl void create(mixed ...) +  //! @decl void create(int|float date) +  //! @decl void create()   //! Apart from the standard creation methods   //! (julian day, etc), you can create a stardate   //! from the stardate number. The length
33:   //!   //! You can also omit any arguments to create now.   //! - //! known bugs: +  //! @bugs    //! Since the precision is limited to the float type - //! of pike you can get non-precise results: +  //! of Pike you can get non-precise results:    //! - //! <pre> +  //! @code{    //! > Calendar.Second(Calendar.Stardate.Day(Calendar.Year()));    //! Result: Second(Fri 31 Dec 1999 23:59:18 CET - Sun 31 Dec 2000 23:59:18 CET) - //! </pre> +  //! @}          void create(mixed ...args)
93:    len=0.0;    }    - // method float tic() - // This gives back the start of the stardate period, - // as a float. -  +  //! This gives back the start of the stardate period, +  //! as a float.    float tic()    {    return t;    }    - //! method float tics() - //! This gives back the number of stardate tics - //! in the period. -  +  //! This gives back the number of stardate tics +  //! in the period.    float tics()    {    return len;    }    - //! method int number_of_seconds() - //! method int number_of_days() - //! This gives back the Gregorian/Earth/ISO number of seconds - //! and number of days, for convinience and conversion to - //! other calendars. -  +  //! This gives back the Gregorian/Earth/ISO number of seconds, +  //! for convinience and conversion to other calendars.    int number_of_seconds()    {    return (int)(len/TNGSTARPERSECOND);    }    -  +  //! This gives back the Gregorian/Earth/ISO number of days, +  //! for convinience and conversion to other calendars.    int number_of_days()    {    return (int)(len/TNGSTARPERJULIAN);
268:    return sprintf("%.3f",t);    }    - //! string format_long(void|int precision) - //! string format_short(void|int precision) - //! string format_vshort(void|int precision) - //! Format the stardate tick nicely. Precision is the number of decimals. Defaults to 3. - //! <pre> - //! long "-322537.312" - //! short "77463.312" (w/o >100000-component) - //! vshort "7463.312" (w/o >10000-component) - //! </pre> +  //! @decl string format_long(void|int precision) +  //! @decl string format_short(void|int precision) +  //! @decl string format_vshort(void|int precision) +  //! Format the stardate tick nicely. Precision is the number of +  //! decimals. Defaults to 3. +  //! @xml{<matrix> +  //! <r><c>long</c><c>"-322537.312"</c><c></c></r> +  //! <r><c>short</c><c>"77463.312"</c><c>(w/o >100000-component)</c></r> +  //! <r><c>vshort</c><c>"7463.312"</c><c>(w/o >10000-component)</c></r> +  //! </matrix>@}       string format_long(void|int p)    {
304:   // global convinience functions   //------------------------------------------------------------------------    - //! method Time.TimeofDay now() - //! Give the zero-length time period of the - //! current time. -  + //! Give the zero-length time period of the current time.   .Time.TimeofDay now()   {    return Tick();   }