Branch: Tag:

2003-06-19

2003-06-19 16:49:19 by Johan Sundström <oyasumi@gmail.com>

Added a TimeRange method format_commonlog(), a tzname_utc_offset() primitive (+HHMM) and tzname_location(), which, when available, digs out zone names like Europe/Stockholm.

Rev: lib/modules/Calendar.pmod/Time.pmod:1.25
Rev: lib/modules/Calendar.pmod/YMD.pike:1.5

741:   //! 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] + //! commonlog "02/Jun/2000:20:53:14 +0100" [2]   //! </pre>   //! <tt>[1]</tt> note conflict (think 1 February 2003)   //! <br><tt>[2]</tt> language dependent
824:    "00:00:00",format_tod());    }    +  string format_commonlog() +  { +  if (!base) make_base(); +  return replace(base->format_commonlog(), +  "00:00:00 ",format_tod()+" "); +  } +     string format_tod()    {    if (ls==CALUNKNOWN) make_local();
948:    :sprintf("UTC-%d:%02d:%02d",u/3600,(u/60)%60,u%60);    }    +  string tzname_utc_offset() +  { +  int u=utc_offset(); +  return sprintf("%+03d%02d", -u/3600, abs(u)/60%60); +  }    -  +  string tzname_location() +  { +  string location = rules->timezone->zoneid; +  if (location || tzn) return location || tzn; +  return [utco,tzn]=rules->timezone->tz_ux(ux), tzn; +  }      // -----------------------------------------------------------------