TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: THE NATURAL PHILOSOPHER
from: NOTREAL
date: 2018-09-25 23:26:00
subject: Re: Formatting for UTC Da

The Natural Philosopher wrote:

> On 25/09/18 13:34, NotReal wrote:
> > The Natural Philosopher wrote:
> >
> > > On 24/09/18 16:01, NotReal wrote:
> > > > The Natural Philosopher wrote:
> > > >
> > > > > 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;
> > > >
> > > >
> > > > That was a noble idea.  I added the following lines to sunclock.c after
> > > > “case 'Y'” at line 2048.
> > > >
> > > >
> > > > /*
> >>>  * Begin Add for UTC Week
> > > > */
> >>>                case 'f': strcpy(num, Day_name[gtp.tm_wday]); break;
> >>>                case 'e': sprintf(num, "%02d", gtp.tm_mday); break;
> >>>                case 'k': sprintf(num, "%02d", 1+gtp.tm_yday); break;
> >>>                case 'c': strcpy(num, Month_name[gtp.tm_mon]); break;
> >>>                case 'n': sprintf(num, "%02d", 1+gtp.tm_mon); break;
> >>>                case 'v': {
> >>>                   int w = gtp.tm_year+1900;
> >>>                   if (w % 4==0 && (w % 100!=0 || w % 400 == 0))
> >>>                     w = 366;
> >>>                   else
> >>>                     w = 365;
> >>>                   sprintf(num, "%d", w);
> >>>                   break;
> >>>                   }
> >>>                case 'w': sprintf(num, "%02d", gtp.tm_year%100); break;
> >>>                case 'W': sprintf(num, "%d", gtp.tm_year+1900); break;
> > > >
> > > > /*
> >>>  * End Add for UTC Week
> > > > */
> > > >
> > > > I figured that was enough to at least try but that is where the
> > > > experiment ended.  Let me first preface this by stating that although I
> > > > have been a Slackware user for many years, this is my first foray into
> > > > Raspian.  When I went to compile after the additions, I was expecting
> > > > to do “./configure”, “make”, and “make install”, but after
reading the
> > > > INSTALL file I knew that was not going to happen.  I first tried
“xmkmf
> > > > “, but that resulted in “command not found”.
> > > >
> > > > I next tried. “make -f Makefile.noimake “ but that immediately
resulted
> > > > in “fatal error: X11/Xatom.h: No such file or directory”.   A
search for
> > > > “Xatom.h.” showed that it was more than a path problem.  It just
wasn’t
> > > > there on the Pi.
> > > >
> > > > A search on my Slackware server however showed that it did have an
> > > > “Xatom.h” file so I tried to do a compile on that using “make -f
> > > > Makefile.noimake”.  It apparently then found the “Xatom.h” file
but it
> > > > also produced tons of new warnings and errors until it finally bombed
> > > > out.  I tried it with both the unmodified and modified versions of
> > > > sunclock.c, so it is not just my tinkering that was the problem,
> > > > although I have to admit there were a few more errors in the modified
> > > > version.
> > > >
> > > > Based on my level of expertise, as in a lack of, I think I am done on
> > > > this effort.
> > > >
> > > > Thanks for trying.
> >>>
> > > https://wiki.debian.org/Packaging/SourcePackage
> > >
> > > Download the source pakage and proceed as indicated. It should 'just
> > > build'
> > >
> > > You need to be root probly to build stuff
> > >
> > > Then make the changes and try again.
> >
> > As a first time user of Raspian and the Pi, this has been quite a lengthy
> > learning experience.   After much reading I found and installed the
> > “Synaptic Package Manager” That allowed me to find and install all the
> > packages needed to use “xmkmf”.   Once I had “xmkmf” installed, I
continued
> > to use SPM to find and install the needed packages to provide files such as
> > Xatom.h that “xmkmf” said were missing during the compile.   With each
> > stumbling block overcome, I was hopeful that I might eventually reach a
> > point of a complete compile - but apparently not.
> >
>
> I susopecvt you are using entrirely te wrong build tools


Perhaps you can tell for sure based on my responses further down.


>
> > The latest compile (without any modifications to the source code) ended
with
> > many errors that all stated the same thing about “*fd is a pointer..”
The
> > first error message is shown below.
> >
> > ______
> >
> >
> > In file included from readvmf.c:31:0:
> > readvmf.c: In function ‘getdata’:
> > readvmf.c:353:7: error: ‘*fd’ is a pointer; did you mean to use
‘->’?
> >      i = gzgetc(fd);
> >           ^
> >          ->
> > _______
> >
> >
> > It then exited with
> >
> > _______
> >
> > : recipe for target 'readvmf.o' failed
> > make: *** [readvmf.o] Error 1
> >
> > ______
> >
> > As someone who only has experience in writing bash scripts, I am not sure I
> > will live long enough to do all the reading needed to fix those errors
> > without creating a bunch of new errors.
> >
>
> You didnt download the source package did you?

I have tried several different source code packages without success.   The one
I am currently using is from “Master.zip” that I downloaded using this
link.

https://github.com/mdoege/Sunclock/archive/master.zip

It unzips to several files and directories and one of directories,
“sunclock-3.57”, seems to have the source code.  Most of the files are
dated
Aug 14 2016 so I would think that is the latest and greatest version.




>
> You are almost certainly missing some library or header files


I used this link to see what I needed.

https://packages.debian.org/stretch/sunclock


This is what I have at the moment

libc6:armhf
libc6-armhf-cross
libc6-dbg:armhf
libc6-dev:armhf
libc6-dev-armhf-cross
libjpeg62-turbo:armhf
libjpeg62-turbo-dev:armhf
libpng16-16:armhf
libx11-6:armhf
libxpm4:armhf


>
>
>
> >
> > P.S.   After doing the above I came back here and noted your wiki link but
I
> > think that page only suggested what I was doing here using a different set
> > of steps - unless I missed something. That is very possible.
> >
>
> No, that is a sumpole apt based system no xkmf involved


I could not find sumpole but I did see references to simple apt.  I am hoping
that was just a typo.   Either way it looks like I need to do more reading.

And people have told me Slackware is not the easiest distribution. It seems
much easier to me than this.

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.