I want to get unix time in my program, google just brought up how to get time on a unix system (I'm on a dos/windows system). Is there an easy (can fit in less than 20 lines of non-system dependent functions and without any API or WIN32 [unless simple] functions) way to do this?
I am very aware about the January 19 2038 problem.
I have seen time_t but don't know how to use it at all (or for this).
Zssffssz
-4
Junior Poster
Recommended Answers
Jump to PostIf you are on a Windows box then UNIX time is pretty useless, yes?
Maybe you want something like 'seconds since the epoch' or similar to that?
Jump to PostMaybe you need to clarify what you mean by Unix Time. AFAIK, time is time. What are the differences you know that we don't?
Jump to PostSeriously, what is the difference between calling
time()
on Unix vs Windows? What is it you are really looking for?
Jump to Post> Seriously, what is the difference between calling time() on Unix vs Windows?
Seriously? It depends. Entirely on the C library implementation that is being used.
POSIX requires that time() returns a 32-bit integral type holding the number of seconds elapsed since midnight (UTC) of January 1, 1970, …
Jump to Post> a technically correct answer isn't always the best answer to a question.
I realize that a question that is asked is not always the most appropriate one. Though in this case there is no evidence to suggest that that is the case. No matter what, deliberately giving a …
All 18 Replies
L7Sqr
227
Practically a Master Poster
chary8088
-3
Newbie Poster
Zssffssz
-4
Junior Poster
chary8088
-3
Newbie Poster
Zssffssz
-4
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Zssffssz
-4
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Zssffssz
-4
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
vijayan121
1,152
Posting Virtuoso
mike_2000_17
commented:
it was about time in this thread for a real answer to come! nice!
+14
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
vijayan121
1,152
Posting Virtuoso
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
vijayan121
1,152
Posting Virtuoso
WaltP
commented:
Stop being pedantic. You've been here long enough to know hacks don't become moderators. Basically, you have less cred than I do in that case.
-4
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.