error problems

B

Bill Cunningham

James said:
Dates, times, or dates+times can be represented several different
ways in a computer. Choice of representation affects what is easy
to do with them.

Ok I think I'm beginning to see. I was just going to use and ansi or iso
c sort function to sort. I'm just trying to get a struct to store in and
pull from right now.
 
O

osmium

Bill Cunningham said:
If I wanted to add yesterdays data today, would time.h be a very good
way to go? I keep track of friday's data. Sometimes I add it on saturdays.
Does this make sense?

Yes, you can handle that. You can record the current date by using the time
function or you can fabricate a different date using the mktime function.
Sorting will be relatively straightforward too. I suggest you write a
little stand alone program using those two functions (and whatever is
necessary to prove that it works) to see what you might be in for. You will
almost surely need some material to supplement K&R. Writing a separate
program will allow you to FOCUS.
 
I

Ike Naar

With the date representation you mentioned (six characters or digits
for mmddyy) it is easy to do input and output but less easy to do
arithmetic (such as the amount of time between two dates, or what
day is 180 days after a date). To do such arithmetic, you may need
to compute carries; for example, "021811" + 14 days = "030311".

Do you live in a place where 11 is a leap year?
 
C

Coos Haak

Op Sat, 19 Feb 2011 22:19:42 +0000 (UTC) schreef James Waldby:
No, but if you misread the calendar properly, the
above works out. :)

Only when it's midnight in Greenwich, evening in Europe and Africa and
morning in America ;)
 
B

Bill Cunningham

Ike said:
Do you live in a place where 11 is a leap year?

Me ? No. But I never considered that. I wanted easy IO of dates. Now I
have others to thank for telling (or reminding) me of time.h though I never
really knew its power. I will probably use mktime.

B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top