On 23/09/18 21:17, NotReal wrote:
> I am in need of some assistance in configuring the time display on
> “sunclock: version 3.56, J.-P. Demailly”. After fiddling around with
> the .rcfile, I have managed to configure the local time (EDT) and date
> in the lower left corner of the display and the UTC date and time on
> the lower right -- well almost. The date that is supposed to be UTC
> remains as the local date. The result is that the date is wrong
> between 20:00 and 24:00 local each day. I have found the UTC
> switches for UTC hour (%G) and minutes (%N) but I cannot find what I
> should use for UTC day of the week, day, month, and year. I have a
> feeling there are no such switches, but it doesn’t hurt to ask.
>
This is all there is (function writeStrip in sunclock.c)
I suggest you add some code to this section and recompile
##############################################
case 'G': sprintf(num, "%02d", gtp.tm_hour);
break;
case 'H': sprintf(num, "%02d", ltp.tm_hour); break;
case 'M': sprintf(num, "%02d", ltp.tm_min); break;
case 'N': sprintf(num, "%02d", gtp.tm_min);
break;
case 'P': num[0]=ampm; num[1]='\0'; break;
case 'S': sprintf(num, "%02d", ltp.tm_sec); break;
#ifdef NEW_CTIME
case 'Z': strcpy(num, ltp.tm_zone); break;
#else
case 'Z': strcpy(num, tzname[ltp.tm_isdst]); break;
#endif
case 'a': strcpy(num, Day_name[ltp.tm_wday]);
break;
case 'd': sprintf(num, "%02d", ltp.tm_mday); break;
case 'h': sprintf(num, "%02d", hour); break;
case 'j': sprintf(num, "%02d", 1+ltp.tm_yday);
break;
case 'b': strcpy(num, Month_name[ltp.tm_mon]);
break;
case 'm': sprintf(num, "%02d", 1+ltp.tm_mon);
break;
case 't': {
int w = ltp.tm_year+1900;
if (w % 4==0 && (w % 100!=0 || w % 400 == 0))
w = 366;
else
w = 365;
sprintf(num, "%d", w);
break;
}
case 'y': sprintf(num, "%02d",
ltp.tm_year%100); break;
case 'Y': sprintf(num, "%d", ltp.tm_year+1900);
break;
case 'U': {
struct tm ftm;
time_t ftime;
int w;
/*
* define weeknumber
* week #1 = week with the first thursday
*/
/* set reference date to 1st of january,
12:00:00 */
(void) memset(&ftm, 0, sizeof(struct tm));
ftm.tm_isdst = -1;
ftm.tm_mon = 0;
ftm.tm_mday = 1;
ftm.tm_year = ltp.tm_year;
ftm.tm_hour = 12;
ftm.tm_min = 0;
ftm.tm_sec = 0;
ftime = mktime(&ftm);
ftm = *localtime(&ftime);
/* get first sunday (start of week) */
if (ftm.tm_wday < 5)
w = 1 - ftm.tm_wday;
else
w = 8 - ftm.tm_wday;
/* get weeknumber */
sprintf(num, "%02d",
((ltp.tm_yday+1-ltp.tm_wday-w)/7)+1);
break;
}
case '_': c = ' ';
default: num[0] = c; num[1] = '\0'; break;
--
Microsoft : the best reason to go to Linux that ever existed.
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|