Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #102722

Re: Could you explain what meanings are in this time help contents?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Could you explain what meanings are in this time help contents?
Date 2017-01-29 19:20 +0000
Organization A noiseless patient Spider
Message-ID <87fuk1r7vh.fsf@bsb.me.uk> (permalink)
References <58fe223e-7877-4fab-a883-cbaf3ae7d809@googlegroups.com>

Show all headers | View raw


fl <rxjwg98@gmail.com> writes:

> I want to learn ctime usage. Accidentally see the following link:
>
> http://ps-2.kev009.com/wisclibrary/aix51/usr/share/man/info/en_US/a_doc_lib/libs/basetrf1/ctime.htm#SPTA0909BAC

<snip>
> char *ctime ( Clock)
> const time_t *Clock;
>
> struct tm *localtime (Clock)
> const time_t *Clock;
>
> struct tm *gmtime (Clock)
> const time_t *Clock;

<re-ordered>
> It is noticed that the first line in each pair has no ';' at the end.
> It is puzzling to me for their meanings.
> There are three same lines beginning with 'const'.
>
> Could you explain to me what each pair is for?

That's just old K&R C.  In the days before ANSI (and later ISO) C a
function was defined by listing the parameter names in the ()s and then
giving the declarations before the opening { of the function body:

  double square(x)
  double x;
  {
      return x*x;
  }

Of course there were no function prototypes, so writing

  double square(x)
  double x;

on it's own is not valid C (there must be a function body following the
declarations) but the best that old manual pages could do was show the
start of the function definition.

Nowadays, it would be written like this:

       char *asctime(const struct tm *tm);
       char *ctime(const time_t *timep);
       struct tm *gmtime(const time_t *timep);
       struct tm *localtime(const time_t *timep);

(Taken directly from "man ctime" on my machine.)

You should probably look for more up to date documentation.

<snip>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Could you explain what meanings are in this time help contents? fl <rxjwg98@gmail.com> - 2017-01-29 11:04 -0800
  Re: Could you explain what meanings are in this time help contents? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-29 19:20 +0000
  Re: Could you explain what meanings are in this time help contents? Keith Thompson <kst-u@mib.org> - 2017-01-29 13:26 -0800

csiph-web