linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* undefined reference to `_fxstat'
@ 2003-09-26 15:43 rgomez
  2003-10-01 19:40 ` convert time to UTC, strptime() returns -1 ? J.
  0 siblings, 1 reply; 4+ messages in thread
From: rgomez @ 2003-09-26 15:43 UTC (permalink / raw)
  To: linux-c-programming

I'm having some problems compiling wterm.

When I make ./configure it's seems to be all ok but in the make steep I
get this:

gcc -o wterm command.o graphics.o grkelot.o main.o menubar.o misc.o netdisp.o
rmemset.o screen.o scrollbar2.o utmp.o xdefaults.o xpm.o -L/usr/X11R6/lib
 -lSM -lICE -L/usr/X11R6/lib -lXpm -lX11 -lWMaker -lutil
/usr/X11R6/lib/libXpm.so: undefined reference to `_fxstat'
collect2: ld returned 1 exit status

I'm sure I have libXpm:
[pedsgrr2@edsrgr00 wterm-6.2.9]$ ll /usr/X11R6/lib/libXpm.so 
-rwxr-xr-x 1 root root 81K sep 17 16:05 /usr/X11R6/lib/libXpm.so*

[pedsgrr2@edsrgr00 pedsgrr2]$ nm /usr/X11R6/lib/libXpm.so | grep _fxstat
         U _fxstat






^ permalink raw reply	[flat|nested] 4+ messages in thread

* convert time to UTC, strptime() returns -1 ?
  2003-09-26 15:43 undefined reference to `_fxstat' rgomez
@ 2003-10-01 19:40 ` J.
  2003-10-03 22:28   ` Luciano Miguel Ferreira Rocha
  0 siblings, 1 reply; 4+ messages in thread
From: J. @ 2003-10-01 19:40 UTC (permalink / raw)
  To: linux-c-programming

Hello,

I am affraid, I got lost a little in all the time functions that are
arround.

I want to convert a time string to an UTC value. Unfortunatly my program,
and me of course are failing at this. :(

I convert the string with strftime() to a `time struct'. 
An then convert that value with strptime(), which returns -1.

The source code.

#include <stdio.h>
#include <time.h>

int main(void) {
 struct tm timestruct;
 
/* the time string to be converted to an UTC value */
 char tstr[] = "Sun Sep 28 00:00:04 2003";
 char utc[16];

 printf("string     = %s\n", tstr);
 
 /* Convert / read the time into the time structure */
 if(strptime(tstr, "%a %b %d %T %Ey", &timestruct) == 0)
  return;
 else {
  printf("strptime() = ");
  
 /* print the time structure, works fine */
 printf("%02d %02d %02d:%02d:%02d %2d\n", timestruct.tm_mon,
  timestruct.tm_mday, timestruct.tm_hour, timestruct.tm_min, 
  timestruct.tm_sec, timestruct.tm_year);

  /* 
   * convert the time structure to an UTC time value 
   * And here the program FAILS. strftime() returns -1 
   */
  strftime(utc, sizeof(utc), "%s", &timestruct);
  printf("strftime() = %s\n", utc);
 }

 return 0;
}

The output is:
string     = Sun Sep 28 00:00:04 2003
strptime() = 08 28 00:00:04 2003
strftime() = -1

If the algo or anything else is bad, or if you have tips, hints or
solutions of some kind. I would be very greatfull!

Thnkx, J.

--
LonkyWong


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: convert time to UTC, strptime() returns -1 ?
  2003-10-01 19:40 ` convert time to UTC, strptime() returns -1 ? J.
@ 2003-10-03 22:28   ` Luciano Miguel Ferreira Rocha
  2003-10-06 21:02     ` convert time to UTC, THNKX ... solved J.
  0 siblings, 1 reply; 4+ messages in thread
From: Luciano Miguel Ferreira Rocha @ 2003-10-03 22:28 UTC (permalink / raw)
  To: J.; +Cc: linux-c-programming

On Wed, Oct 01, 2003 at 09:40:44PM +0200, J. wrote:
>  if(strptime(tstr, "%a %b %d %T %Ey", &timestruct) == 0)
                                  ^^^^
You should use %Y, %y or %EY. For %Ey, the number is an offset from %EC,
that in my current locale is 1900.

So the year is ending up in 3903, beyond the 32/31 bit limit for the
number of seconds from Jan 1 1970.

Regards,
Luciano Rocha

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: convert time to UTC, THNKX ... solved ...
  2003-10-03 22:28   ` Luciano Miguel Ferreira Rocha
@ 2003-10-06 21:02     ` J.
  0 siblings, 0 replies; 4+ messages in thread
From: J. @ 2003-10-06 21:02 UTC (permalink / raw)
  To: linux-c-programming

On Fri, 3 Oct 2003, Luciano Miguel Ferreira Rocha wrote:

> On Wed, Oct 01, 2003 at 09:40:44PM +0200, J. wrote:
> >  if(strptime(tstr, "%a %b %d %T %Ey", &timestruct) == 0)
>                                   ^^^^
> You should use %Y, %y or %EY. For %Ey, the number is an offset from %EC,
> that in my current locale is 1900.
> 
> So the year is ending up in 3903, beyond the 32/31 bit limit for the
> number of seconds from Jan 1 1970.
> 
> Regards,
> Luciano Rocha

Ah great it works ... ! As you suggested. 

Merci

J.

--
AonkyKong


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-10-06 21:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-26 15:43 undefined reference to `_fxstat' rgomez
2003-10-01 19:40 ` convert time to UTC, strptime() returns -1 ? J.
2003-10-03 22:28   ` Luciano Miguel Ferreira Rocha
2003-10-06 21:02     ` convert time to UTC, THNKX ... solved J.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).