home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / Rw / time.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  20.6 KB  |  706 lines

  1. #ifndef __TIME_CC
  2. #define __TIME_CC
  3. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  4. /***************************************************************************
  5.  *
  6.  * time.cc - Definitions for the Standard Library time facets
  7.  *
  8.  *
  9.  ***************************************************************************
  10.  *
  11.  * Copyright (c) 1994-1999 Rogue Wave Software, Inc.  All Rights Reserved.
  12.  *
  13.  * This computer software is owned by Rogue Wave Software, Inc. and is
  14.  * protected by U.S. copyright laws and other laws and by international
  15.  * treaties.  This computer software is furnished by Rogue Wave Software,
  16.  * Inc. pursuant to a written license agreement and may be used, copied,
  17.  * transmitted, and stored only in accordance with the terms of such
  18.  * license and with the inclusion of the above copyright notice.  This
  19.  * computer software or any other copies thereof may not be provided or
  20.  * otherwise made available to any other person.
  21.  *
  22.  * U.S. Government Restricted Rights.  This computer software is provided
  23.  * with Restricted Rights.  Use, duplication, or disclosure by the
  24.  * Government is subject to restrictions as set forth in subparagraph (c)
  25.  * (1) (ii) of The Rights in Technical Data and Computer Software clause
  26.  * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
  27.  * Commercial Computer Software รป Restricted Rights at 48 CFR 52.227-19,
  28.  * as applicable.  Manufacturer is Rogue Wave Software, Inc., 5500
  29.  * Flatiron Parkway, Boulder, Colorado 80301 USA.
  30.  *
  31.  **************************************************************************/
  32.  
  33. #include <time.h>
  34.  
  35. #ifndef _RWSTD_NO_NAMESPACE
  36. namespace __rwstd {
  37. #endif
  38.  
  39. // --------------------------------------
  40. // Template time_reader member templates.
  41. // --------------------------------------
  42.  
  43. template <class charT,class InputIterator>
  44. time_reader<charT,InputIterator>::time_reader
  45.     (InputIterator& in,InputIterator& end,_RW_STD::ios_base& io,
  46.      const __RWSTD::timepunct<charT>& tpunct)
  47.   : digit_reader<charT,InputIterator>(in,end,io), __timp(tpunct)
  48. {
  49.   // Don't recognize signs on any numeric input.
  50.   this->is_signed=false;
  51. }
  52.  
  53. template <class charT,class InputIterator>
  54. bool time_reader<charT,InputIterator>::
  55.     get_time_pattern (const string_type &patt,tm *time)
  56. {
  57.   enum {
  58.     edit_year    = 0x01,
  59.     edit_month   = 0x02,
  60.     edit_century = 0x04,
  61.     edit_hour    = 0x08
  62.   };
  63.  
  64.   int post_edits=0;
  65.   const charT *p=patt.c_str(),*patt_end=p+patt.length();
  66.   for ( ; p<patt_end; p++) {
  67.     switch (this->ctyp.narrow(*p,' ')) {
  68.      case '%':
  69.       {
  70.         int *iresult;
  71.         int ampm_dummy;  // scratch space for ampm value
  72.         const keyword_map<charT> *keywords=NULL;
  73.  
  74.         switch (this->ctyp.narrow(*++p,' ')) {
  75.          case 'a':
  76.          case 'A':
  77.           // Day of week (abbreviated or not).
  78.           keywords=&get_day_map(__timp);
  79.           iresult=&time->tm_wday;
  80.           break;
  81.          case 'b':
  82.          case 'B':
  83.           // Month name (abbreviated or not).
  84.           keywords=&get_month_map(__timp);
  85.           iresult=&time->tm_mon;
  86.           break;
  87.          case 'm':
  88.           // Numeric month, comes in 1 higher than the number we want.
  89.           post_edits|=edit_month;
  90.           iresult=&time->tm_mon;
  91.           break;
  92.          case 'c':
  93.           // Full date, time and year in default format.
  94.           return get_time_pattern(get_patt_string(__timp,2),time);
  95.          case 'd':
  96.           // Day of month.
  97.           iresult=&time->tm_mday;
  98.           break;
  99.          case 'I': // 12-hour clock
  100.          case 'H': // 24-hour clock
  101.           // Hours (12/24 distinction is made in the 'p' section)
  102.           iresult=&time->tm_hour;
  103.           break;
  104.          case 'p':
  105.           // am/pm indicator
  106.           keywords=&get_ampm_map(__timp);
  107.           //  Assumes charT[0] are equal means entire string will be
  108.           if (*(this->in) == get_ampm_string(__timp,true)[0])
  109.             post_edits|=edit_hour;
  110.           iresult=&m_dummy;
  111.           break;
  112.          case 'M':
  113.           // Minutes.
  114.           iresult=&time->tm_min;
  115.           break;
  116.          case 'S':
  117.           // Seconds.
  118.           iresult=&time->tm_sec;
  119.           break;
  120.          case 'Y':
  121.           // Year with Century.
  122.           post_edits|=edit_year;
  123.           iresult=&time->tm_year;
  124.           break;
  125.          case 'y':
  126.           // 2-digit Year without Century.
  127.           post_edits|=(edit_year|edit_century);
  128.           iresult=&time->tm_year;
  129.           break;
  130.          default:
  131.           // All other format characters are not supported on input.
  132.           return false;
  133.         }
  134.  
  135.         if (keywords) {
  136.           if ((*iresult=get_keyword(*keywords))<0)
  137.             return false;
  138.         } else
  139.           *iresult=to_ulong(this->get_int_digits());
  140.       }
  141.       break;
  142.  
  143.      default:
  144.       if (!this->at_end() && *this->in==*p)
  145.         this->in++;
  146.       else
  147.         return false;
  148.     }
  149.  
  150.     if (this->error)
  151.       return false;
  152.   }
  153.  
  154.   if (post_edits&edit_year)
  155.     if (post_edits&edit_century && time->tm_year<100)
  156.       ; // 2-digit year is already relative to 1900
  157.     else
  158.       time->tm_year-=1900;
  159.  
  160.   if (post_edits&edit_month)
  161.     time->tm_mon--;
  162.  
  163.   if (post_edits&edit_hour)
  164.     if (time->tm_hour < 12)
  165.       time->tm_hour+=12;
  166.  
  167.   return true;
  168. }
  169. #ifndef _RWSTD_NO_NAMESPACE
  170. } namespace std {
  171. #endif
  172. // -----------------------------------------------------
  173. // Facet time_get<charT,InputIterator> member templates.
  174. // -----------------------------------------------------
  175.  
  176. template <class charT, class InputIterator>
  177. locale::id time_get<charT,InputIterator>::id;
  178.  
  179. template <class charT, class InputIterator>
  180. time_get<charT,InputIterator>::~time_get() { }
  181.  
  182. template <class charT, class InputIterator>
  183. time_base::dateorder time_get<charT,InputIterator>::do_date_order () const
  184. {
  185.   // We would prefer to return a value that matches the date format defined
  186.   // in the timepunct facet in the caller's locale, but we can't get there
  187.   // from here ...
  188.  
  189. #ifndef _RWSTD_NO_NAMESPACE
  190.     const _TYPENAME __RWSTD::timepunct<charT>::string_type& s =
  191.         __RWSTD::keyword_cracker<charT>::get_patt_string(*__timp,0);
  192. #else
  193.     const _TYPENAME timepunct<charT>::string_type& s =
  194.         keyword_cracker<charT>::get_patt_string(*__timp,0);
  195. #endif
  196.  
  197.   bool haveYear = false;
  198.  
  199.   for (size_t i = 0; i < s.length(); i++) {
  200.     if (s[i] == charT('y') || s[i] == charT('Y')) haveYear = true;
  201.     if (s[i] == charT('d') || s[i] == charT('a') || s[i] == charT('A'))
  202.       if (haveYear) return ydm;
  203.       else return dmy;
  204.     if (s[i] == charT('m') || s[i] == charT('b') || s[i] == charT('B'))
  205.       if (haveYear) return ymd;
  206.       else return mdy;
  207.   }
  208.  
  209.   return no_order;
  210. }
  211.  
  212. template <class charT, class InputIterator>
  213. _TYPENAME time_get<charT,InputIterator>::iter_type
  214. time_get<charT,InputIterator>::do_get_time (InputIterator in,
  215.     InputIterator end, ios_base& io, ios_base::iostate& err, tm* time) const
  216. {
  217.   __RWSTD::time_reader<charT,InputIterator> reader(in,end,io,*__timp);
  218.   err=ios_base::goodbit;
  219.  
  220.   // Parse according to pattern 1 (strftime '%X' -- default time pattern)
  221.   if (!reader.get_time_pattern(reader.get_patt_string(reader.__timp,1),time))
  222.     err=ios_base::failbit;
  223.  
  224.   if (reader.reached_end)
  225.     err|=ios_base::eofbit;
  226.     
  227.   return in;
  228. }
  229.  
  230. template <class charT, class InputIterator >
  231. _TYPENAME time_get<charT,InputIterator>::iter_type
  232. time_get<charT,InputIterator>::do_get_date (InputIterator in,
  233.     InputIterator end, ios_base& io, ios_base::iostate& err, tm* time) const
  234. {
  235.   __RWSTD::time_reader<charT,InputIterator> reader(in,end,io,*__timp);
  236.   err=ios_base::goodbit;
  237.  
  238.   // Parse according to pattern 0 (strftime '%x' -- default date pattern)
  239.   if (!reader.get_time_pattern(reader.get_patt_string(reader.__timp,0),time))
  240.     err=ios_base::failbit;
  241.  
  242.   if (reader.reached_end)
  243.     err|=ios_base::eofbit;
  244.  
  245.   return in;
  246. }
  247.  
  248. template <class charT, class InputIterator >
  249. _TYPENAME time_get<charT,InputIterator>::iter_type
  250. time_get<charT,InputIterator>::do_get_weekday (InputIterator in,
  251.     InputIterator end, ios_base& io, ios_base::iostate& err, tm* time) const
  252. {
  253.   __RWSTD::time_reader<charT,InputIterator> reader(in,end,io,*__timp);
  254.   int wd=reader.get_keyword(reader.get_day_map(reader.__timp));
  255.   err=ios_base::goodbit;
  256.  
  257.   if (wd<0)
  258.     err=ios_base::failbit;
  259.   else
  260.     time->tm_wday=wd;
  261.  
  262.   if (reader.reached_end)
  263.     err|=ios_base::eofbit;
  264.  
  265.   return in;
  266. }
  267.  
  268. template <class charT, class InputIterator >
  269. _TYPENAME time_get<charT,InputIterator>::iter_type
  270. time_get<charT,InputIterator>::do_get_monthname (InputIterator in,
  271.     InputIterator end, ios_base& io, ios_base::iostate& err, tm* time) const
  272. {
  273.   __RWSTD::time_reader<charT,InputIterator> reader(in,end,io,*__timp);
  274.   int mo=reader.get_keyword(reader.get_month_map(reader.__timp));
  275.   err=ios_base::goodbit;
  276.  
  277.   if (mo<0)
  278.     err=ios_base::failbit;
  279.   else
  280.     time->tm_mon=mo;
  281.  
  282.   if (reader.reached_end)
  283.     err|=ios_base::eofbit;
  284.  
  285.   return in;
  286. }
  287.  
  288. template <class charT, class InputIterator >
  289. _TYPENAME time_get<charT,InputIterator>::iter_type
  290. time_get<charT,InputIterator>::do_get_year (InputIterator in,
  291.     InputIterator end, ios_base& io, ios_base::iostate& err, tm* time) const
  292. {
  293.   __RWSTD::time_reader<charT,InputIterator> reader(in,end,io,*__timp);
  294.   int yr=reader.to_ulong(reader.get_int_digits());
  295.   err=ios_base::goodbit;
  296.  
  297.   // 2-digit year numbers are accepted, but are not treated specially, and so
  298.   // end up in the 1st century C.E.
  299.   if (reader.error)
  300.     err=ios_base::failbit;
  301.   else
  302.     time->tm_year=yr-1900;
  303.  
  304.   if (reader.reached_end)
  305.     err|=ios_base::eofbit;
  306.  
  307.   return in;
  308. }
  309.  
  310. // -----------------------------------------------------
  311. // Facet time_put<charT,InputIterator> member templates.
  312. // -----------------------------------------------------
  313.  
  314. template <class charT, class OutputIterator>
  315. locale::id time_put<charT,OutputIterator>::id;
  316.  
  317. template <class charT, class OutputIterator>
  318. time_put<charT,OutputIterator>::~time_put() { }
  319.  
  320. template <class charT, class OutputIterator>
  321. OutputIterator time_put<charT,OutputIterator>::put
  322.     (OutputIterator out, ios_base &io, charT fill, const tm *time,
  323.      const charT* pattern, const charT* patt_end) const
  324. {
  325.   size_t patt_len=patt_end-pattern;
  326.   char scratch[40];
  327.   char *narrow_patt=(patt_len<=sizeof scratch)? scratch : new char[patt_len];
  328.   
  329.   #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  330.   use_facet<ctype<charT> >(io.getloc()).narrow(pattern,patt_end,' ',narrow_patt);
  331.   #else
  332.   use_facet(io.getloc(),(ctype<charT>*)0).narrow(pattern,patt_end,' ',narrow_patt);
  333.   #endif
  334.  
  335.   char *np=narrow_patt;
  336.   for (const charT* wp=pattern; wp<patt_end; wp++,np++)
  337.     if (*np!='%')
  338.       *out++=*wp;
  339.     else if (++wp<patt_end)
  340.       switch (*++np) {
  341.  
  342.        case 'O':
  343.         // POSIX-style modifier
  344.         if (++wp<patt_end)
  345.           out=do_put(out,io,fill,time,*++np,'O');
  346.         break;
  347.  
  348.        case '%':
  349.         // Literal percent sign
  350.         *out++=*wp;
  351.         break;
  352.  
  353.        default:
  354.         // Treat everything else as a time format specifier.
  355.         out=do_put(out,io,fill,time,*np,' ');
  356.       }
  357.  
  358.   if (narrow_patt!=scratch)
  359.     delete[] narrow_patt;
  360.  
  361.   return out;
  362. }
  363.  
  364. template <class charT, class OutputIterator>
  365. OutputIterator time_put<charT,OutputIterator>::do_put
  366.     (OutputIterator out, ios_base &io, charT fill, const tm *time,
  367.      char format, char modifier) const
  368. {
  369.  
  370.   static const char do_as_pattern[]="xXcDrT";
  371.   const char *p=strchr(do_as_pattern,format);
  372.   if (p) {
  373.     // Catch formats implemented as calls to the pattern-based method before
  374.     // going to the expense of constructing a digit_writer.
  375.     unsigned i=p-do_as_pattern;
  376. #ifndef _RWSTD_NO_NAMESPACE
  377.     const _TYPENAME __RWSTD::timepunct<charT>::string_type& s =
  378.         __RWSTD::keyword_cracker<charT>::get_patt_string(*__timp,i);
  379. #else
  380.     const _TYPENAME timepunct<charT>::string_type& s =
  381.         keyword_cracker<charT>::get_patt_string(*__timp,i);
  382. #endif
  383.     return put(out,io,fill,time,s.c_str(),s.c_str()+s.length());
  384.   }
  385.  
  386.   __RWSTD::digit_writer<charT,OutputIterator> writer(out,io);
  387.   writer.width=0;
  388.  
  389.   if (modifier=='O') {
  390.     // Uppercase letter O (not zero) -- requests ordinal string if defined.
  391.     int n,m;
  392.     switch (format) {
  393.      case 'C':
  394.       // Exclusive Rogue Wave extension: Lets you announce, 
  395.       // "Welcome to the %OC century!"  (See note on unmodified 'C' below.)
  396.       n=(time->tm_year+1999)/100;
  397.       break;
  398.      case 'd':
  399.      case 'e':
  400.       n=time->tm_mday;
  401.       break;
  402.      case 'H':
  403.       n=time->tm_hour+1;
  404.       break;
  405.      case 'I':
  406.       n=time->tm_hour+1;
  407.       if (n>12)
  408.         n-=12;
  409.       break;
  410.      case 'm':
  411.       n=time->tm_mon+1;
  412.       break;
  413.      case 'M':
  414.       n=time->tm_min+1;
  415.       break;
  416.      case 'S':
  417.       n=time->tm_sec+1;
  418.       break;
  419.      case 'u':
  420.       n=time->tm_wday;
  421.       if (n==0) n=7;
  422.       break;
  423.      case 'w':
  424.       n=time->tm_wday;
  425.       break;
  426.      case 'U':
  427.       // Week number of year (assuming weeks start on Sunday).
  428.       // set m to wday of first day of year
  429.       m = (time->tm_wday)-((time->tm_yday)%7);
  430.       // Correct m to account for "days before first Sunday"
  431.       // and "Sunday first day of year" conditions
  432.       if ( m <= 0 ) 
  433.         m += 7;
  434.       if ( m == 7 )
  435.         // Sunday is first day of year
  436.         n = ((time->tm_yday)/7)+1;
  437.       else
  438.         // if not, shift Sunday to first day of week 1
  439.         n = ((time->tm_yday)+m)/7;
  440.       break;
  441.      case 'W':
  442.       // Week number of year (assuming weeks start on Monday).
  443.       // set m to wday of first day of year
  444.       m = (time->tm_wday)-((time->tm_yday)%7);
  445.       // Correct m to account for "days before first Monday"
  446.       // and "Monday first day of year" conditions
  447.       if ( m <= 0 ) 
  448.         m += 7;
  449.       if ( m == 1 )
  450.         // Monday is first day of year
  451.         n = ((time->tm_yday)/7)+1;
  452.       else
  453.         // if not, shift Monday to first day of week 1
  454.         n = (((time->tm_yday)+(m-1))/7);
  455.       break;
  456.      case 'y':
  457.       n=((time->tm_year+1900)%100)+1;
  458.       break;
  459.      default:
  460.       n=999; // Cause error output.
  461.     }
  462.  
  463.     writer.put_keyword(writer.get_ord_string(*__timp,n),fill);
  464.  
  465.   } else {
  466.     bool abbrev=false;
  467. #ifndef _RWSTD_NO_NAMESPACE
  468.     const _TYPENAME __RWSTD::timepunct<charT>::string_type *s=NULL;
  469.     _TYPENAME __RWSTD::timepunct<charT>::string_type tzs;
  470. #else
  471.     const _TYPENAME timepunct<charT>::string_type *s=NULL;
  472.     _TYPENAME timepunct<charT>::string_type tzs;
  473. #endif
  474.  
  475.     int n,m;
  476.  
  477.     writer.radix=10;
  478.     writer.separable=false;
  479.  
  480.     switch (format) {
  481.      case 'a':
  482.       abbrev=true;
  483.      case 'A':
  484.       // Week day name or abbreviation.
  485.       s=&writer.get_day_string(*__timp,time->tm_wday,abbrev);
  486.       break;
  487.  
  488.      case 'b':
  489.      case 'h':
  490.       abbrev=true;
  491.      case 'B':
  492.       // Month name or abbreviation.
  493.       s=&writer.get_month_string(*__timp,time->tm_mon,abbrev);
  494.       break;
  495.  
  496.      case 'C':
  497.       // Century.  Note that we begin the 20th century in 1901, not 1900.  
  498.       // The draft standard does not seem to address this controversy.
  499.       n=(time->tm_year+1999)/100;
  500.       break;
  501.  
  502.      case 'd':
  503.       // Day of month with leading zero.
  504.       writer.iprecision=2;
  505.      case 'e':
  506.       // Day of month with leading blank.
  507.       n=time->tm_mday;
  508.       writer.width=2;
  509.       break;
  510.  
  511.      case 'H':
  512.       // Hour (24-hour clock).
  513.       n=time->tm_hour;
  514.       writer.iprecision=2;
  515.       break;
  516.  
  517.      case 'I':
  518.       // Hour (12-hour clock, caller must append am/pm to resolve ambiguity).
  519.       n=time->tm_hour;
  520.       if (n==0)
  521.         n=12;
  522.       else if (n>12)
  523.         n-=12;
  524.       writer.iprecision=2;
  525.       break;
  526.  
  527.      case 'j':
  528.       // 3-digit day of year.
  529.       n=time->tm_yday+1;
  530.       writer.iprecision=3;
  531.       break;
  532.  
  533.      case 'm':
  534.       // Month number.
  535.       n=time->tm_mon+1;
  536.       writer.iprecision=2;
  537.       break;
  538.  
  539.      case 'M':
  540.       // Minutes.
  541.       n=time->tm_min;
  542.       writer.iprecision=2;
  543.       break;
  544.  
  545.      case 'n':
  546.       // Newline character.
  547.       *out++=writer.ctyp.widen('\n');
  548.       break;
  549.  
  550.      case 'p':
  551.       // ante/post meridian string.
  552.       s=&writer.get_ampm_string(*__timp,time->tm_hour>=12);
  553.       break;
  554.  
  555.      case 'S':
  556.       // Seconds.
  557.       n=time->tm_sec;
  558.       writer.iprecision=2;
  559.       break;
  560.  
  561.      case 't':
  562.       // Tab character.
  563.       *out++=writer.ctyp.widen('\t');
  564.       break;
  565.  
  566.      case 'u':
  567.       // Weekday (1-7, 1==Monday)
  568.       n=time->tm_wday;
  569.       if (n==0)
  570.         n=7;
  571.       break;
  572.  
  573.      case 'U':
  574.       // Week number of year (assuming weeks start on Sunday).
  575.       // set m to wday of first day of year
  576.       m = (time->tm_wday)-((time->tm_yday)%7);
  577.       // Correct m to account for "days before first Sunday"
  578.       // and "Sunday first day of year" conditions
  579.       if ( m <= 0 ) 
  580.         m += 7;
  581.       if ( m == 7 )
  582.         // Sunday is first day of year
  583.         n = ((time->tm_yday)/7)+1;
  584.       else
  585.         // if not, shift Sunday to first day of week 1
  586.         n = ((time->tm_yday)+m)/7;
  587.       writer.iprecision=2;
  588.       break;
  589.  
  590.      case 'w':
  591.       // Weekday (0-6, 0==Sunday).
  592.       n=time->tm_wday;
  593.       break;
  594.  
  595.      case 'W':
  596.       // Week number of year (assuming weeks start on Monday).
  597.       // set m to wday of first day of year
  598.       m = (time->tm_wday)-((time->tm_yday)%7);
  599.       // Correct m to account for "days before first Monday"
  600.       // and "Monday first day of year" conditions
  601.       if ( m <= 0 ) 
  602.         m += 7;
  603.       if ( m == 1 )
  604.         // Monday is first day of year
  605.         n = ((time->tm_yday)/7)+1;
  606.       else
  607.         // if not, shift Monday to first day of week 1
  608.         n = (((time->tm_yday)+(m-1))/7);
  609.       writer.iprecision=2;
  610.       break;
  611.  
  612.      case 'y':
  613.       // Year without century.
  614.       n=(time->tm_year+1900)%100;
  615.       writer.iprecision=2;
  616.       break;
  617.         
  618.      case 'Y':
  619.       // Year with century.
  620.       n=time->tm_year+1900;
  621.       break;
  622.  
  623.      case 'Z':
  624.  
  625.       // Time zone name (This is really standard, isn't it?)
  626.       #ifdef _RWSTD_STRUCT_TM_TZ
  627.       tzs = __RWSTD::timepunct<charT>::string_type(
  628.                writer.ctyp.widen(time->tm_zone));
  629.       s = &tzs;
  630.       break;
  631.       #else
  632.       # ifndef _RWSTD_NO_GLOBAL_TZ
  633.       #  ifndef _RWSTD_STRICT_ANSI
  634.       #  ifdef _RWSTD_NO_LEADING_UNDERSCORE
  635.       tzs = __RWSTD::timepunct<charT>::string_type(
  636.                writer.ctyp.widen(tzname[time->tm_isdst ? 1 : 0]));
  637.       #else
  638.       tzs = __RWSTD::timepunct<charT>::string_type(
  639.                writer.ctyp.widen(_tzname[time->tm_isdst ? 1 : 0]));
  640.       #  endif
  641.       #  else
  642.       charT* __temp;
  643.       __temp = 0;
  644.       #  ifdef _RWSTD_NO_LEADING_UNDERSCORE
  645.       writer.ctyp.widen(tzname[time->tm_isdst ? 1 : 0], tzname[time->tm_isdst ? 1 : 0] + strlen(tzname[time->tm_isdst ? 1 : 0]), __temp);
  646.       #  else
  647.       writer.ctyp.widen(_tzname[time->tm_isdst ? 1 : 0], _tzname[time->tm_isdst ? 1 : 0] + strlen(_tzname[time->tm_isdst ? 1 : 0]), __temp);
  648.       #  endif
  649.       tzs = __temp;
  650.       #  endif
  651.       s = &tzs;
  652.       break;
  653.       # endif // _RWSTD_NO_GLOBAL_TZ
  654.       #endif // _RWSTD_STRUCT_TM_TZ
  655.  
  656.      default:
  657.       // Everything else is an error.
  658.       s=&writer.get_day_string(*__timp,99,false);
  659.     }
  660.  
  661.     if (s)
  662.       writer.put_keyword(*s,fill);
  663.     else {
  664.       writer.digitize((unsigned long) n);
  665.       writer.put_digits(fill);
  666.     }
  667.   }
  668.  
  669.   return out;
  670. }
  671. // --------------------------------------------------------------------
  672. // Time input by-name member templates: time_get<charT,InputIterator>
  673. // --------------------------------------------------------------------
  674.  
  675. template <class charT, class InputIterator >
  676. time_get_byname<charT, InputIterator>::time_get_byname
  677.     (const char* name, size_t refs): time_get<charT,InputIterator>(refs)
  678.   this->__name = name;
  679. }
  680.  
  681. template <class charT, class InputIterator>
  682. time_get_byname<charT, InputIterator>::~time_get_byname()
  683. { }
  684.  
  685. // --------------------------------------------------------------------
  686. // Time output by-name member templates: time_put<charT,InputIterator>
  687. // --------------------------------------------------------------------
  688.  
  689. template <class charT, class OutputIterator>
  690. time_put_byname<charT,OutputIterator>::time_put_byname
  691.     (const char* name, size_t refs): time_put<charT,OutputIterator>(refs)
  692.   this->__name = name;
  693. }
  694.  
  695. template <class charT, class OutputIterator>
  696. time_put_byname<charT,OutputIterator>::~time_put_byname()
  697. { }
  698. #ifndef _RWSTD_NO_NAMESPACE
  699. #endif
  700.  
  701. #pragma option pop
  702. #endif /* __TIME_CC */
  703.