/****************************************************************************** * This file is part of a software distribution, which is furnished under the * * terms of a license. Use of this software by any means is subject to this * * license and signifies the acceptance of the licensing terms stated * * therein. Please see the file LICENSE in the top-level directory of this * * software distribution for detailed copyright disclaimers and licensing * * terms. * ****************************************************************************** * Copryight (c) by Andreas S. Wetzel - All rights reserved. * ******************************************************************************/ /* $Id: clock.c,v 1.2 2001/03/19 14:54:01 mickey Exp $ */ #include #include /*** Externals ***/ extern VP vp; /* * void update_clock(void); * * Update the RTC contained in the status bar. * This function is called from heartbeat() when necessary. */ void update_clock(void) { char tbuf[6]; time_t now; /* * Update clock */ time(&now); strftime((char *)&tbuf, 6, "%H:%M", localtime(&now)); alter_status(STAT_CLOCK, "%s ", tbuf); update_status(0); } /* * void update_onlinetime(time_t online); * * Update the online clock counter contained in the status bar. * This function is called from heartbeat() when necessary. */ void update_onlinetime(time_t online) { u_short onl_days; u_char onl_hours; u_char onl_minutes; /* * Update online time */ onl_days = (online / 0x15180); online = (online % 0x15180); onl_hours = (online / 0xE10); online = (online % 0xE10); onl_minutes = (online / 60); if(!onl_days) { alter_status(STAT_ONLINE, "%02d:%02d ", onl_hours, onl_minutes); } else { alter_status(STAT_ONLINE, "%dd+%02d:%02d", onl_days, onl_hours, onl_minutes); } update_status(0); }