Sunclock - interim patch for 4.2BSD-derived systems
John Mackin
john at cluster.cs.su.oz.au
Sun Oct 7 14:59:29 AEST 1990
I forgot to include support for vanilla 4.2 style systems in the
sunclock program that I recently posted to comp.sources.x. In
an attempt to stem the flood of mail, here is an interim patch,
which you should apply if (1) you do not have a "tm_zone" in
your struct tm, and (2) you do not have an "extern char tzname[]";
in other words, if your system is 4.2-like.
Please let me know if none of the _three_ methods of getting the
local timezone name work for you.
Just feed this article to "patch" if you want to apply it. Please
retain the original file for the first official patch, which will
address this issue in a more sophisticated manner, as well as fixing
other problems. (Don't hold your breath waiting for it to come out,
though, as one of them seems to be awfully hard to debug.)
--
John Mackin, Basser Department of Computer Science,
University of Sydney, Sydney, Australia; <john at cs.su.oz.AU>
``Reading your standard output doesn't sound like a very good idea to me.''
*** sunclock.c Sun Sep 30 19:51:20 1990
--- sunclock.c-4.2 Sat Oct 6 00:56:00 1990
***************
*** 62,67 ****
--- 62,69 ----
#define VERSION "1.0"
#include "sunclock.h"
+ #include <sys/types.h>
+ #include <sys/timeb.h>
struct sunclock {
int s_width; /* size of pixmap */
***************
*** 95,100 ****
--- 97,103 ----
char * strrchr();
long time();
+ char * timezone();
double jtime();
double gmst();
***************
*** 879,894 ****
register struct tm * gmtp;
{
static char s[80];
sprintf(s,
"%02d:%02d:%02d %s %s %02d %s %02d %02d:%02d:%02d UTC %s %02d %s %02d",
ltp->tm_hour, ltp->tm_min,
ltp->tm_sec,
! #ifdef NEW_CTIME
! ltp->tm_zone,
! #else
! tzname[ltp->tm_isdst],
! #endif
Wdayname[ltp->tm_wday], ltp->tm_mday,
Monname[ltp->tm_mon], ltp->tm_year % 100,
gmtp->tm_hour, gmtp->tm_min,
--- 882,899 ----
register struct tm * gmtp;
{
static char s[80];
+ struct timeb tp;
+ if (ftime(&tp) < 0) {
+ fprintf(stderr, "%s: ftime failed: ");
+ perror("");
+ exit(1);
+ }
sprintf(s,
"%02d:%02d:%02d %s %s %02d %s %02d %02d:%02d:%02d UTC %s %02d %s %02d",
ltp->tm_hour, ltp->tm_min,
ltp->tm_sec,
! timezone(tp.timezone, tp.dstflag),
Wdayname[ltp->tm_wday], ltp->tm_mday,
Monname[ltp->tm_mon], ltp->tm_year % 100,
gmtp->tm_hour, gmtp->tm_min,
More information about the Comp.sources.bugs
mailing list