Real Date (C Programming)?

  8 posts   Feedicon  
Replies: 7 - Last Post: March 02, 2010 09:52
by: Behzad Asadi Isfahani
showing 1 - 8 of 8
 
Posted: January 03, 2010 07:43 by Behzad Asadi Isfahani
Hi All
I have a digit in second since 01/01/1994 like 0x325E1E19.
When I'm trying to pass it to localtime() I need to receive the date in a format.
localtime() calculate the digit since 01/01/1900.
So I received the Fri Oct 11 13:44:49 1996 result, whereas a 01/02/2010 12:07:41.
I need to know how I can calculate the date since 1994.

I'll happy to receive your idea.

**************************
Regards
Behzad Asadi Isfahani.
**************************
 
Posted: January 03, 2010 16:32 by john_brock
Just a thought, but I would get the digit for 01/01/1994 and then add that to whatever digit you get from your app interface. Adding those together and returning the formatted date from there, should get you the date since 1994.

Haven't tested any of this, but it seems like it should work.

--jb
 
Posted: January 03, 2010 16:44 by Behzad Asadi Isfahani
Hi

The localtime(const time_t* __timer) function accept a number in long int.(mean 32bit)
In 32 bit only can store a number from -2147483648 to 2147483647.
So, Adding take an overflow.


Thanks for your time.
****************************
Regards
Behzad Asadi Isafahani
****************************
 
Posted: January 03, 2010 18:35 by john_brock
Ahhh, I see the problem.

Maybe look into the phenomenon that Gregorian calendars repeat every 28 years.

http://www.timeanddate.com/calendar/repeating.html?country=1&year=2010

This is an interesting problem. I hope someone else will jump in with a specific answer for you.

--jb
 
Posted: January 25, 2010 11:22 by Behzad Asadi Isfahani
Hi All,

Is anybody to reply me?

I need to know how I can convert it,
I'm very happy If anybody exists known the solution.
I'm still waiting for.

Regards
Behzad Asadi Isfahani.
 
Posted: January 14, 2010 06:59 by Behzad Asadi Isfahani
Hi
Thanks for your time.
This does not fix my problem.
Can you help me more? please.
Regards
Behzad Asadi Isfahani
 
Posted: February 01, 2010 07:39 by Behzad Asadi Isfahani
Hi
I'm still waiting.

Regards
Behzad Asadi Isfahani
 
Posted: March 02, 2010 09:52 by Behzad Asadi Isfahani
HI ALL
I've found what the problem was, I'd like to share it to help every body If they have it.

There is an Endianness subject in www.Wikipedia.org , it's not bad to read.
That could help me to resolve my problem.
http://en.wikipedia.org/wiki/Endianness

Have good times
Best Regard
Behzad Asadi Isfahani

showing 1 - 8 of 8
Replies: 7 - Last Post: March 02, 2010 09:52
by: Behzad Asadi Isfahani
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close