On Fri, Mar 29, 2002 at 06:27:16PM -0500, Wolf J.Flywheel wrote:
>       If it helps, the date seems to be a standard timestamp.  I'm a Perl 
> novice, but you can convert times from Licq history files using Perl's 
> "localtime" function, as in this program I spent 2 minutes writing.  
> (If I'd taken 3 minutes, it might be easier to use.)

For what it's worth...

bash$ perl -le 'print scalar localtime 979353712'
Sat Jan 13 02:41:52 2001

>       You can probably grep through the history stuff in Licq source code to 
> find the C way to change to human-readable dates, but I don't have it 
> handy.

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

int main(int argc,char**argv) {
   long input;
   time_t clock;
   char tmp;
   struct tm *tp;

   /* collect input from command line as a long integer */
   if (argc!=2 || sscanf(argv[1], "%ld%c", &input, &tmp)!=1) {
      fputs("Supply numeric argument!\n",stderr);
      exit(1);
   }
   clock = input; /* type conversion (to be pedantic) */

   /* here's where we convert it to the date/time */
   tp = localtime(&clock);
   printf("%04d-%02d-%02d %02d:%02d:%02d %s\n",
      tp->tm_year+1900,
      tp->tm_mon+1,
      tp->tm_mday,
      tp->tm_hour,
      tp->tm_min,
      tp->tm_sec,
      tzname[tp->tm_isdst>0]
   );
   return 0;
}

$ gcc -o timeconv timeconv.c
$ ./timeconv 979353712
2001-01-13 02:41:52 GMT
$ ./timeconv 1017744044
2002-04-02 11:40:44 BST

imc

_______________________________________________
Licq-main mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/licq-main

Reply via email to