× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ah...

    D MyTime          DS                  based(tm)
      Unixtime = 1173954308 ;
      mytime = gmtime(Unixtime) ;

Shouldn't you code it like this:

      Unixtime = 1173954308 ;
      tm = gmtime(Unixtime) ;

-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of B.Quindt@xxxxxxxxxxxx
Sent: Thursday, March 15, 2007 9:15 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: C-Function gmtime() within ILE RPG


Hi to all,

we have a Database with a Unix Time Field and I want to use
the Unix Function gmtime() I coded the following RPGLE.
But with these Parameter I get a wrong result in MYTime Structure.



H BndDir('QC2LE')
D gmtime          Pr              *   ExtProc('gmtime')
D  t_time                       10I 0 Value

D MyTime          DS                  based(tm)
D tm_sec                        10i 0
D tm_min                        10i 0
D tm_hour                       10i 0
D tm_mday                       10i 0
D tm_mon                        10i 0
D tm_year                       10i 0
D tm_wday                       10i 0
D tm_yday                       10i 0
D tm_isdst                      10i 0
 *
D tm              S               *   INZ
D UnixTime        S             10I 0
 * -------------------------------------------------
 /free

      Unixtime = 1173954308 ;
      mytime = gmtime(Unixtime) ;

      return ;
 * -------------------------------------------------

In C it looks like

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

int main(void)
{
  time_t ltime;
  struct tm *ptm;
  ltime = 1173954308;
  ptm =  gmtime(&ltime);

  printf ("Coordinated Universal Time is %s\n",
  asctime(gmtime(&ltime)));
}

/************************ Output should be similar to: **********

Coordinated Universal Time is Thu Mar 15 14:14:35 2007  */


Thanks for Help
Burkhard Quindt



ZAPF GmbH
Nuernberger Stra_e 38 - 95440 Bayreuth - Telefon (09 21) 6 01-0 - Telefax (09
21) 6 01-6 77
Sitz der Gesellschaft: Bayreuth - Registergericht: AG Bayreuth HRB 3204
Geschaeftsfuehrer: Dipl.-Kfm. Rolf Baresel - Dipl.-Ing. (FH) Manfred Meinzer -
Thierry Potok
info@xxxxxxxxxxxx - www.zapf-gmbh.de


RECHTSHINWEIS | Diese E-Mail enthaelt vertrauliche und/oder rechtlich
geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die
unbefugte Weitergabe dieser Mail ist nicht gestattet.

LEGAL NOTICE | This e-mail may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorized copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.