Package: wmcalclock Version: 1.25-9 Severity: wishlist I tend to think of days as ending when I go to sleep, usually after midnight, and I sometimes get confused when my computer clock shows the date change at midnight. So I wrote this patch to wmCalClock to make it display what one might call "30-hour mode": Times between midnight and 6 AM are displayed as belonging to the previous day, so the range of hours runs from 6 to 29. Maybe other people would find it useful as well. Here is the patch:
diff -Naur wmcalclock-1.25/Src/wmCalClock.1 wmcalclock-1.25-rwbarton/Src/wmCalClock.1 --- wmcalclock-1.25/Src/wmCalClock.1 2005-01-29 10:16:35.000000000 +0000 +++ wmcalclock-1.25-rwbarton/Src/wmCalClock.1 2005-01-29 10:30:06.000000000 +0000 @@ -25,6 +25,11 @@ .B \-24 Show time in 24-hour format instead of default 12-hour AM/PM format. .TP +.B \-30 +Show local time in 30-hour format. Times between midnight and 6 AM +are displayed as belonging to the previous day, so the hour ranges +from 6 to 29. +.TP .B \-g Show Greenwich Mean Time (GMT). .TP diff -Naur wmcalclock-1.25/Src/wmCalClock.c wmcalclock-1.25-rwbarton/Src/wmCalClock.c --- wmcalclock-1.25/Src/wmCalClock.c 2005-01-29 10:06:31.000000000 +0000 +++ wmcalclock-1.25-rwbarton/Src/wmCalClock.c 2005-01-29 10:31:11.000000000 +0000 @@ -259,6 +259,7 @@ int yAMPM = 95; int ydAMPM = 6; int Show24HourTime = 0; +int Show30HourTime = 0; int ShowGreenwichTime = 0; int ShowSiderealTime = 0; double Longitude; @@ -502,6 +503,26 @@ gmst = (gmst - (double)Mins)*60.0; Secs = (int)gmst; + } else if (Show30HourTime){ + + CurrentLocalTime = time(CurrentTime); + Time = localtime(&CurrentLocalTime); + + /* Careful. Need to handle daylight savings time changes correctly. */ + if (Time->tm_hour < 6){ + int old_hour = Time->tm_hour; + time_t new_time = CurrentLocalTime - 24 * 60 * 60; + Time = localtime(&new_time); + Time->tm_hour = old_hour + 24; + } + + DayOfMonth = Time->tm_mday-1; + DayOfWeek = Time->tm_wday; + Month = Time->tm_mon; + Hours = Time->tm_hour; + Mins = Time->tm_min; + Secs = Time->tm_sec; + } else { CurrentLocalTime = time(CurrentTime); @@ -803,6 +824,11 @@ Show24HourTime = 1; + } else if (!strcmp(argv[i], "-30")){ + + Show24HourTime = 1; /* Don't display AM/PM */ + Show30HourTime = 1; + } else if (!strcmp(argv[i], "-b")){ if ((i+1 >= argc)||(argv[i+1][0] == '-')) { @@ -883,6 +909,7 @@ printf("\t-e \"Command\"\tCommand to execute via double click of mouse button 1.\n"); printf("\t-S\t\tDo not show seconds.\n"); printf("\t-24\t\tShow 24-hour time. Default is 12 hour AM/PM Time.\n"); + printf("\t-30\t\tShow 30-hour local time (hour ranges from 6 to 29).\n"); printf("\t-g\t\tShow Greenwich time.\n"); printf("\t-s\t\tShow Greenwich Mean Sidereal Time (GMST) in 24-hour format. \n"); printf("\t-L <Longitude>\tShow Local Sidereal Time (LST) in 24-hour format. \n"); -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.4.24 Locale: LANG=C, LC_CTYPE=C Versions of packages wmcalclock depends on: ii libc6 2.3.2.ds1-11 GNU C Library: Shared libraries an ii xlibs 4.3.0-7 X Window System client libraries m -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]