pr_time.c (8b56c58be4643a21fa74ddf390f8f358d10ae284) | pr_time.c (e8e649cc5dd773fdde330d58c17c9f03e2f28286) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 38 unchanged lines hidden (view full) --- 47 48#include "extern.h" 49 50/* 51 * pr_attime -- 52 * Print the time since the user logged in. 53 */ 54void | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 38 unchanged lines hidden (view full) --- 47 48#include "extern.h" 49 50/* 51 * pr_attime -- 52 * Print the time since the user logged in. 53 */ 54void |
55pr_attime(started, now) 56 time_t *started, *now; | 55pr_attime(time_t *started, time_t *now) |
57{ 58 static char buf[256]; 59 struct tm tp, tm; 60 time_t diff; 61 char fmt[20]; 62 63 tp = *localtime(started); 64 tm = *localtime(now); --- 22 unchanged lines hidden (view full) --- 87} 88 89/* 90 * pr_idle -- 91 * Display the idle time. 92 * Returns number of excess characters that were used for long idle time. 93 */ 94int | 56{ 57 static char buf[256]; 58 struct tm tp, tm; 59 time_t diff; 60 char fmt[20]; 61 62 tp = *localtime(started); 63 tm = *localtime(now); --- 22 unchanged lines hidden (view full) --- 86} 87 88/* 89 * pr_idle -- 90 * Display the idle time. 91 * Returns number of excess characters that were used for long idle time. 92 */ 93int |
95pr_idle(idle) 96 time_t idle; | 94pr_idle(time_t idle) |
97{ 98 /* If idle more than 36 hours, print as a number of days. */ 99 if (idle >= 36 * 3600) { 100 int days = idle / 86400; 101 (void)printf(" %dday%s ", days, days > 1 ? "s" : " " ); 102 if (days >= 100) 103 return (2); 104 if (days >= 10) --- 17 unchanged lines hidden --- | 95{ 96 /* If idle more than 36 hours, print as a number of days. */ 97 if (idle >= 36 * 3600) { 98 int days = idle / 86400; 99 (void)printf(" %dday%s ", days, days > 1 ? "s" : " " ); 100 if (days >= 100) 101 return (2); 102 if (days >= 10) --- 17 unchanged lines hidden --- |