public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Day Number
       [not found] <616BE6A276E3714788D2AC35C40CD18D7404B9@whale.softwire.co.uk>
@ 2002-07-29  6:52 ` Rupert Wood
  2003-04-10  0:59   ` STRUCTURE AS225
  0 siblings, 1 reply; 3+ messages in thread
From: Rupert Wood @ 2002-07-29  6:52 UTC (permalink / raw)
  To: dbisnath; +Cc: gcc-help

dbisnath wrote:

> How does one get the day number e.g. Sunday = 0, Monday = 1 etc ?

1. Use the time() function to get the system time value
2. Use localtime() or gmtime() to parse the time value into a tm struct
3. Read the tm_wday member from the structure.

e.g.

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

    int main(void)
    {
        time_t t;
        struct tm* tmLocal;

        time(&t);
        tmLocal = localtime(&t);
        if (tmLocal != NULL)
        {
            printf("It's day number %d (0=Sunday, etc.)\n",
                tmLocal->tm_wday);
        }
        else
        {
            printf("Error computing day number.\n");
            return 1;
        }

        return 0;
    }

You can get further information on these functions from the manual
pages, i.e. type 'man localtime'.

Rup.

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

* STRUCTURE
  2002-07-29  6:52 ` Day Number Rupert Wood
@ 2003-04-10  0:59   ` AS225
  0 siblings, 0 replies; 3+ messages in thread
From: AS225 @ 2003-04-10  0:59 UTC (permalink / raw)
  To: gcc-help

Hi all,

I am in the process of moving from UNIX to LINUX.

I have sevral application programs written fortran and
compiled in UNIX environment. Some of the programs
have STRUCTURE. Below is a simple example of it.

      STRUCTURE / RLINE/
         INTEGER     ID
         INTEGER     SEX
         INTEGER     YEAR
      END STRUCTURE
      record /rline/ line(MIN:MAX)

In LINUX I could not compile those programs that
contain STRUCTURE. Can anybody help me how to compile
fortan programs that contain STRUCTRE in LINUX. I want
to compile  it without the chaning it, if it is
possible.


Thanks in advance
AMS


=====


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

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

* Day Number
@ 2002-07-29  5:40 dbisnath
  0 siblings, 0 replies; 3+ messages in thread
From: dbisnath @ 2002-07-29  5:40 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

Hi,
How does one get the day number e.g. Sunday = 0, Monday = 1 etc ?
I want to test the day number against a variable e.g.
if ( dayNumber == DaynumberVar )
  do x,y,z

Thanks

---------------------------------------
This message was sent using Postaci Webmail. (http://www.trlinux.com)

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

end of thread, other threads:[~2003-04-10  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D7404B9@whale.softwire.co.uk>
2002-07-29  6:52 ` Day Number Rupert Wood
2003-04-10  0:59   ` STRUCTURE AS225
2002-07-29  5:40 Day Number dbisnath

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 read-only IMAP folder(s) and NNTP newsgroup(s).