473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

C wiki - struct tm

http://alien.dowling.edu/~rohit/wiki...andard_Library

Q: How are months of a year numbered in C?

Answer makes reference to "the Standard specifies struct tm". Does the
C standard actually define struct tm, or is it Posix that defines it?

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Nov 15 '05 #1
7 5446


Kenneth Brody wrote:
http://alien.dowling.edu/~rohit/wiki...andard_Library

Q: How are months of a year numbered in C?

Answer makes reference to "the Standard specifies struct tm". Does the
C standard actually define struct tm, or is it Posix that defines it?


Section 7.23.1, paragraph 4.

--
Er*********@sun.com

Nov 15 '05 #2
Kenneth Brody <ke******@spamcop.net> writes:
Q: How are months of a year numbered in C?

Answer makes reference to "the Standard specifies struct tm". Does the
C standard actually define struct tm, or is it Posix that defines it?


It is in the C standard. See e.g. C99 7.23.1 paragraphs 3 and 4.
--
"I'm not here to convince idiots not to be stupid.
They won't listen anyway."
--Dann Corbit
Nov 15 '05 #3
Kenneth Brody wrote:
http://alien.dowling.edu/~rohit/wiki...andard_Library

Q: How are months of a year numbered in C?

Answer makes reference to "the Standard specifies struct tm". Does the
C standard actually define struct tm, or is it Posix that defines it?


The C standard defines struct tm as follows:

7.23 Date and time <time.h>
7.23.1 Components of Time
....
4 The range and precision of times representable in clock_t and
time_t are implementation-defined. The tm structure shall
contain at least the following members, in any order. The
semantics of the members and their normal ranges are expressed
in the comments.

int tm_sec; // seconds after the minute — [0, 60]
int tm_min; // minutes after the hour — [0, 59]
int tm_hour; // hours since midnight — [0, 23]
int tm_mday; // day of the month — [1, 31]
int tm_mon; // months since January — [0, 11]
int tm_year; // years since 1900
int tm_wday; // days since Sunday — [0, 6]
int tm_yday; // days since January 1 — [0, 365]
int tm_isdst; // Daylight Saving Time flag

The value of tm_isdst is positive if Daylight Saving Time is
in effect, zero if Daylight Saving Time is not in effect, and
negative if the information is not available.

--
Simon.
Nov 15 '05 #4
Hello,

Simon Biber <ne**@ralmin.cc> schrieb:
int tm_sec; // seconds after the minute — [0, 60]
int tm_min; // minutes after the hour — [0, 59]


Is tm_sec really from 0 to 60 (including)? I do not see the sense of it
in contrast to all the others (0.59 for minutes, 0..23 for hour, ...)

What is the rationale behind this? Does it have anything to do with leap
seconds?

Curious,
Spiro.

--
Spiro R. Trikaliotis http://cbm4win.sf.net/
http://www.trikaliotis.net/ http://www.viceteam.org/
Nov 15 '05 #5
Spiro Trikaliotis wrote:
Is tm_sec really from 0 to 60 (including)? I do not see the sense of it
in contrast to all the others (0.59 for minutes, 0..23 for hour, ...)

What is the rationale behind this? Does it have anything to do with leap
seconds?


Yes.
--
Stephen Hildrey
Mail: st***@uptime.org.uk / Tel: +442071931337
Jabber: st***@jabber.earth.li / MSN: fo*@hotmail.co.uk
Nov 15 '05 #6
In article <sl************************@news.trikaliotis.net > Spiro Trikaliotis <ne*********@trikaliotis.net> writes:
Simon Biber <ne**@ralmin.cc> schrieb:
int tm_sec; // seconds after the minute — [0, 60]
int tm_min; // minutes after the hour — [0, 59]


Is tm_sec really from 0 to 60 (including)? I do not see the sense of it
in contrast to all the others (0.59 for minutes, 0..23 for hour, ...)

What is the rationale behind this? Does it have anything to do with leap
seconds?


It has everything to do with leap seconds.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Nov 15 '05 #7
Spiro Trikaliotis wrote:
Simon Biber <ne**@ralmin.cc> schrieb:
int tm_sec; // seconds after the minute — [0, 60]
int tm_min; // minutes after the hour — [0, 59]


Is tm_sec really from 0 to 60 (including)? I do not see the sense
of it in contrast to all the others (0.59 for minutes, 0..23 for
hour, ...)

What is the rationale behind this? Does it have anything to do
with leap seconds?


Precisely. i.e. yes.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 15 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric | last post by:
Greetings Comrades, Pythonistas! I am looking for guidance on the quick and easiest path to set up a Python wiki. A wiki application idea popped into my head while I was making morning coffee. ...
0
by: Brian van den Broek | last post by:
Hi all, There have been a few posts over the last month or so expressing a bit of exasperation with the "rising tide of newbie's". (Or, more accurately, the rising tide of questions from...
65
by: Giannis Papadopoulos | last post by:
Although Steve Summit's C FAQ is really good, are there any C FAQ wikis? -- one's freedom stops where others' begin Giannis Papadopoulos http://dop.users.uth.gr/ University of Thessaly...
302
by: Lee | last post by:
Hi Whenever I use the gets() function, the gnu c compiler gives a warning that it is dangerous to use gets(). Is this due to the possibility of array overflow? Is it correct that the program...
2
by: gangesmaster | last post by:
finally, i opened a wiki for Construct, the "parsing made fun" library. the project's page: http://pyconstruct.sourceforge.net/ the project's wiki: http://pyconstruct.wikispaces.com/ (anyone can...
8
by: Mike S | last post by:
Hi all, I noticed a very slight logic error in the solution to K&R Exercise 1-22 on the the CLC-Wiki, located at http://www.clc-wiki.net/wiki/KR2_Exercise_1-22 The exercise reads as...
4
by: Arild Hystad | last post by:
Hi, for some days now, I haven't been able to reach the clc-wiki. Is it terminated, moved or do I have a network problem? My bookmark says it is at http://clc-wiki.net/wiki/. Is this correct? --...
1
by: relisoft | last post by:
SEATTLE, Washington. - July 12, 2006: Reliable Software® announces the upcoming release of Code Co-op® version 5.0. Code Co-op is an affordable peer-to-peer version control system for distributed...
1
by: Kevin Walzer | last post by:
I'm not sure how often members of this list visit the Tkinter wiki at http://tkinter.unpythonic.net/wiki/FrontPage; this wiki seems to have less traffic in general than the Tcl/Tk wiki at...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.