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


Groups > comp.lang.c > #96063

Re: What about my last date functions? there are some error?

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: What about my last date functions? there are some error?
Date 2016-11-08 10:55 +0000
Organization A noiseless patient Spider
Message-ID <87d1i69r5w.fsf@bsb.me.uk> (permalink)
References <gh932ctlqkebuct208fqbbc7rdak1b2c1o@4ax.com>

Show all headers | View raw


Rosario19 <Ros@invalid.invalid> writes:

> What about my last date functions? there are some error?
> just today i find someones...

Great, a C question!

<snip>
>                            DATES
> Date is 3 numbers integer number: y, m, g where y[one number in
> 0..0xFFFFFF]
> is the year, m[one number in 0..11] is the month g[in 1..31] is the
> day.
>
>     isDate(y,m,g)
> that says if date y,m,g is ok as date [for example y>=0 or 0<=m<=11
> etc]
>
>     GetsDate(number*ry,number*rm,number*rg)
> that gets date from stdin, from file or some other place
> the date in the format  day[ -/\]month[ -/\]year
> and put it in variables *ry=year *rm=month-1 *rg=day
> that represent one date

There's no FILE * parameter, so how does the function know where to get
the date from?

>     PrintDate(y,m,g)
> that print the date
>
>     NDaysMonth(y,m)
> that return the days of the month m of the year y
>
>     NDaysYear(y)
> that return number of days of the year y
>
>     NDayWeek(y,m,g)
> return the number of day for the date y,m,g for example
> 0 for Monday .. 6 for Sunday
>
>     cmp(y,m,g,ya,ma,ga)
> that return -1 if y m g>ya ma ga; 0 if they are the same; else 1
>
>     month(m)
> that return the name of the month m as string [for example month(1)
> return "Feb"]
>
>     day(g)
> as above for month for days 0..6
>
>     Ndays(y,m,g,ya,ma,ga)

I'm surprised you don't have a date structure, at least as an
alternative.

> return the difference in days from (y m g) to (ya ma ga); return one
> negative
> number if  (y m g) > (ya ma ga)
>
>     AddToDateDays(N*ry,N*rm,N*rg,N y,N m,N g,N v)
> sum to date (y,m,g) the number [positive or negative] v; put the date
> result in result (ry,rm,rg)

There's not enough explanation here.  I don't know what this function
does exactly.  The notation (for exaple N*rg) does not help.

> ------------------------------------------------
>     #define R return
>     #define L(i) for(;i-->0;)
>     #define I if
>     #define N int
>     #define C unsigned char
>     #define F for
>     #define G goto
>     #define P printf
>     #define E else

Ah.  I'm not surprised there are bugs, but I'm not going to wade through
this to try to fund any.

<snip>
-- 
Ben.

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


Thread

What about my last date functions? there are some error? Rosario19 <Ros@invalid.invalid> - 2016-11-08 11:28 +0100
  Re: What about my last date functions? there are some error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-08 10:55 +0000
    Re: What about my last date functions? there are some error? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-08 19:00 +0800
    Re: What about my last date functions? there are some error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-08 11:04 +0000
      Re: What about my last date functions? there are some error? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-11-08 19:22 +0800
    Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 11:35 +0000
      Re: What about my last date functions? there are some error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-08 15:46 +0000
        Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 16:20 +0000
          Re: What about my last date functions? there are some error? Rosario19 <Ros@invalid.invalid> - 2016-11-08 17:44 +0100
            Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 16:51 +0000
              Re: What about my last date functions? there are some error? Jerry Stuckle <jstucklex@attglobal.net> - 2016-11-08 13:21 -0500
          Re: What about my last date functions? there are some error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-08 18:06 +0000
            Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 18:56 +0000
              Re: What about my last date functions? there are some error? Keith Thompson <kst-u@mib.org> - 2016-11-08 12:05 -0800
              Re: What about my last date functions? there are some error? David Brown <david.brown@hesbynett.no> - 2016-11-08 21:10 +0100
                Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 20:16 +0000
          Re: What about my last date functions? there are some error? jadill33@gmail.com - 2016-11-08 11:16 -0800
            Re: What about my last date functions? there are some error? Richard Heathfield <rjh@cpax.org.uk> - 2016-11-08 20:08 +0000
            Re: What about my last date functions? there are some error? Keith Thompson <kst-u@mib.org> - 2016-11-08 12:11 -0800
              Re: What about my last date functions? there are some error? Keith Thompson <kst-u@mib.org> - 2016-11-08 12:29 -0800
      Re: What about my last date functions? there are some error? Rosario19 <Ros@invalid.invalid> - 2016-11-08 17:41 +0100
        Re: What about my last date functions? there are some error? asetofsymbols@gmail.com - 2016-11-08 11:26 -0800
          Re: What about my last date functions? there are some error? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-11-08 19:38 +0000
  Re: What about my last date functions? there are some error? Keith Thompson <kst-u@mib.org> - 2016-11-08 08:19 -0800

csiph-web