[BACK]Return to pr_time.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / w

Diff for /src/usr.bin/w/pr_time.c between version 1.11 and 1.12

version 1.11, 2003/06/03 02:56:22 version 1.12, 2003/11/26 00:31:27
Line 49 
Line 49 
 /*  /*
  * pr_attime --   * pr_attime --
  *      Print the time since the user logged in.   *      Print the time since the user logged in.
  *  
  *      Note: SCCS forces the bizarre string manipulation, things like  
  *      8.2 get replaced in the source code.  
  */   */
 void  void
 pr_attime(started, now)  pr_attime(time_t *started, time_t *now)
         time_t *started, *now;  
 {  {
         static char buf[256];          static char buf[256];
         struct tm *tp;          struct tm *tp;
         time_t diff;          time_t diff;
         char fmt[20];          const char *fmt;
         int  today;          int  today;
   
         today = localtime(now)->tm_yday;          today = localtime(now)->tm_yday;
Line 69 
Line 65 
   
         /* If more than a week, use day-month-year. */          /* If more than a week, use day-month-year. */
         if (diff > SECSPERDAY * DAYSPERWEEK)          if (diff > SECSPERDAY * DAYSPERWEEK)
                 (void)strlcpy(fmt, "%d%b%y", sizeof fmt);                  fmt = "%d%b%y";
   
         /* If not today, use day-hour-am/pm. */          /* If not today, use day-hour-am/pm. */
         else if (tp->tm_yday  != today ) {          else if (tp->tm_yday  != today ) {
                 (void)strlcpy(fmt, __CONCAT("%a%", "I%p"), sizeof fmt);                  fmt = "%a%I%p";
         }          }
   
         /* Default is hh:mm{am,pm}. */          /* Default is hh:mm{am,pm}. */
         else {          else {
                 (void)strlcpy(fmt, __CONCAT("%l:%", "M%p"), sizeof fmt);                  fmt = "%l:%M%p";
         }          }
   
         (void)strftime(buf, sizeof(buf) -1, fmt, tp);          (void)strftime(buf, sizeof buf -1, fmt, tp);
         buf[sizeof buf - 1] = '\0';          buf[sizeof buf - 1] = '\0';
         (void)printf("%s", buf);          (void)printf("%s", buf);
 }  }
Line 91 
Line 87 
  *      Display the idle time.   *      Display the idle time.
  */   */
 void  void
 pr_idle(idle)  pr_idle(time_t idle)
         time_t idle;  
 {  {
         int days = idle / SECSPERDAY;          int days = idle / SECSPERDAY;
   

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12