Advertisement Jump to content
Sign in to follow this  

time.h asctime source code?

This topic is 4636 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Basically, if I have the following source code..
	struct tm *ptr;
	time_t lt;
	lt = time(NULL);
	std::cout << asctime(ptr);

and I would like to convert the time in a different format from asctime, I would like to know where I can see the source code for asctime so that I can make my own time conversion function. edit: I did try google for the source code but it seems like time.h's corresponding cpp file is in a *.o file and thus the source code isn't availble in the open.... [Edited by - Tradone on May 8, 2006 12:19:53 PM]

Share this post

Link to post
Share on other sites
You don't really need the source code for asctime to create a time conversion function. Just look at the definition for struct tm. By knowing what fields are available in the structure, you can easily work out any format conversions you want.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!