<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Including time.h from a library.</title>
		<link>http://forums.leaflabs.com/topic.php?id=1277</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:14:06 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1277" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11496</link>
			<pubDate>Mon, 02 Jul 2012 14:11:19 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11496@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Great, glad it's working for you!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11495</link>
			<pubDate>Mon, 02 Jul 2012 13:47:23 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">11495@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok,&#60;/p&#62;
&#60;p&#62;This works in the latest libmaple (with the fixes that mbolivar: and bubulindo: discussed above). &#60;/p&#62;
&#60;p&#62;Thanks for fixing this!!&#60;/p&#62;
&#60;p&#62;Its so nice to be able to manipulate time in an an ansi kind of way!!!!&#60;/p&#62;
&#60;p&#62;Don.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11170</link>
			<pubDate>Fri, 08 Jun 2012 14:57:29 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">11170@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;bubulindo, &#60;/p&#62;
&#60;p&#62;It is in the newlib headers but it it is not in anything that installs in the ide or the version of libmaple that I have (whatever was stable a few months ago). &#60;/p&#62;
&#60;p&#62;Hence the question. &#60;/p&#62;
&#60;p&#62;I suppose I could see if the development branch fattens up wirish_time with more of the useful parts of the ansi time handling but I am working with production code and trying to avoid dev branches. &#60;/p&#62;
&#60;p&#62;FWIW the arduino and wiring pack around the full avr-libc which is complete in these areas.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11151</link>
			<pubDate>Fri, 08 Jun 2012 00:03:42 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11151@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;gbulmer:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
IMHO it should be _WIRISH_TIME_H_ in wirish_time.h to follow the convention; map non-identifier characters to '_', and add '_' start and end.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;The development branch does indeed follow this convention (actually, now we follow the &#60;a href=&#34;http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#The__define_Guard&#34;&#62;Google C++ #define guard guideline's&#60;/a&#62; lead, which roughly says that some/path/header.h becomes &#60;code&#62;_SOME_PATH_HEADER_H_&#60;/code&#62;, to allow for multiple files with the same name throughout the tree).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bubulindo on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11150</link>
			<pubDate>Thu, 07 Jun 2012 23:52:27 +0000</pubDate>
			<dc:creator>bubulindo</dc:creator>
			<guid isPermaLink="false">11150@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;isn't it in time.h? :S
&#60;/p&#62;</description>
		</item>
		<item>
			<title>feurig on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277&amp;page=2#post-11137</link>
			<pubDate>Thu, 07 Jun 2012 14:51:04 +0000</pubDate>
			<dc:creator>feurig</dc:creator>
			<guid isPermaLink="false">11137@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok so I am looking for gmtime and am not finding it in any of the maple libraries or the mapleRTC library. Does that mean that the rtc library has to be compiled against newlib?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7740</link>
			<pubDate>Tue, 17 Jan 2012 17:11:10 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">7740@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;thanks! we will check in to it!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7719</link>
			<pubDate>Tue, 17 Jan 2012 10:31:24 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7719@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;bubulindo - You've found it. Brilliant! Well done.&#60;/p&#62;
&#60;p&#62;You've found a bug. The convention on the &#60;code&#62;#ifdef _FOO_H_ ... #define _FOO_H_&#60;/code&#62; has been broken. (This stops the file being processed twice if it is #included in several places.)&#60;/p&#62;
&#60;p&#62;IMHO it should be &#60;code&#62;_WIRISH_TIME_H_&#60;/code&#62; in wirish_time.h to follow the convention; map non-identifier characters to '_', and add '_' start and end. &#60;/p&#62;
&#60;p&#62;It should not effect any other linking.&#60;br /&#62;
If it does throw up another error, it is likely a bug which needs to be raised to LeafLabs anyway.&#60;/p&#62;
&#60;p&#62;Nice going :-)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bubulindo on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7703</link>
			<pubDate>Mon, 16 Jan 2012 21:45:07 +0000</pubDate>
			<dc:creator>bubulindo</dc:creator>
			<guid isPermaLink="false">7703@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Think I found it. &#60;/p&#62;
&#60;p&#62;In wirish_time.h: &#60;/p&#62;
&#60;p&#62;#ifndef _TIME_H_&#60;br /&#62;
#define _TIME_H_&#60;/p&#62;
&#60;p&#62;In time.h: &#60;/p&#62;
&#60;p&#62;#ifndef _TIME_H_&#60;br /&#62;
#define _TIME_H_&#60;/p&#62;
&#60;p&#62;If I change the TIME_H in the wirish file to WIRISH_TIME_H, it compiles (would have to test it back home).&#60;br /&#62;
Would this change affect any other linking between functions?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7697</link>
			<pubDate>Mon, 16 Jan 2012 19:29:03 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7697@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;bubildiono - you wrote&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;One thing that I need to think about is the support for dates before Epoch... if I could use the counting variable as unsigned and set the &#34;new Epoch&#34; to say 2010, would be nice.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;I was trying to explain reasons for keeping the epoch start at midnight 1st Jan 1970.&#60;/p&#62;
&#60;p&#62;The usual way of finding bugs, when all else fails, is to binary chop the file.&#60;br /&#62;
Identify the code that causes the error by removing sections.&#60;br /&#62;
Because it is a header file, It will likely be easier to work from the back end, as parts earlier in the file may be defining things that are used later.&#60;/p&#62;
&#60;p&#62;I assume you know how to use the pre-processor.&#60;br /&#62;
Use&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;#if 0
   ...
#endif&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;to 'remove' sections of time.h. &#60;/p&#62;
&#60;p&#62;Remove any reference to functions defined in time.h in your sketch, but still include time.h. &#60;/p&#62;
&#60;p&#62;Start by effectively removing everything in time.h, and make sure you don't badly nest with the &#60;code&#62;#ifndef _TIME_H_&#60;/code&#62;.&#60;br /&#62;
This should make the build work.&#60;br /&#62;
Then move the &#60;code&#62;#if 0&#60;/code&#62; and &#60;code&#62;#endif&#60;/code&#62; so that they 'remove' half the file, and add extra &#60;code&#62;#if 0&#60;/code&#62; and &#60;code&#62;#endif&#60;/code&#62; until you have narrowed down the line which makes the build break.&#60;/p&#62;
&#60;p&#62;It is crude, but can be quite quick.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bubulindo on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7694</link>
			<pubDate>Mon, 16 Jan 2012 17:42:17 +0000</pubDate>
			<dc:creator>bubulindo</dc:creator>
			<guid isPermaLink="false">7694@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi, &#60;/p&#62;
&#60;p&#62;I thought it was pretty obvious that my intention is to use time.h. Reason being that it's already there, it works and it has been tested. &#60;/p&#62;
&#60;p&#62;But so far, I wasn't able to include it without problems. So, the functions I took from there are temporary, but I would much rather find a way of including them in my file and work with that. &#60;/p&#62;
&#60;p&#62;Any ideas on how to achieve that?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7686</link>
			<pubDate>Mon, 16 Jan 2012 14:06:03 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7686@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;bublindo - I'd recommend sticking with the types defined in time.h so that, when the bug (time.h and delay() or millis() clash) gets fixed, the 'real' time.h functions can be used. My assumption is your few functions extracted from time.h set are a temporary work around for something that should be fixed properly.&#60;/p&#62;
&#60;p&#62;I would not change time_t from the type exported by time.h.&#60;br /&#62;
So it would only be a 64bit type iff the type exported by time.h is 64 bit.&#60;br /&#62;
Otherwise, people who are accustomed to time.h will get a surprise, and it might break something in the time.h functions. I don't understand the benefit in changing stuff exported from time.h for the sake of it. I assume your functions are a temporary fix.&#60;/p&#62;
&#60;p&#62;I prefer the epoch to start at 12:00 midnight, January 1st, 1970, but I feel the key consideration is staying compatible with time.h. It is that which locks the epoch down.&#60;/p&#62;
&#60;p&#62;IMHO, most people either use the time.h functions to do input or output, or they compare timestamps. &#60;/p&#62;
&#60;p&#62;For timestamp comparison to work it doesn't matter much when the epoch started as long as the maths works. So any arbitrary epoch start, far enough back, but not too far works. &#60;/p&#62;
&#60;p&#62;For input or output using time.h functions, I believe they assume midnight, 1st Jan 1970, and you'd have work to do to change it. If you stick with that epoch start, everything works 'for free'.&#60;/p&#62;
&#60;p&#62;Choosing any other epoch start seems to create work, or make you incompatible with time.h, but I can see no benefit.&#60;/p&#62;
&#60;p&#62;HTH
&#60;/p&#62;</description>
		</item>
		<item>
			<title>r1s3n on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7680</link>
			<pubDate>Mon, 16 Jan 2012 09:00:14 +0000</pubDate>
			<dc:creator>r1s3n</dc:creator>
			<guid isPermaLink="false">7680@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm not sure if you've ever done any Unix programming or not but time 0 is 12:00:00  Jan 1 1970.  Changing that could have some implications if people wanted to port other software and expected a standard behavior.  Anything against typedef'ing a 64 bit signed int as time_t?  That would take care of both ends of your problem, you could have dates in the positive integer ranges from jan 1 1970 to a *VERY* long time after you're dead (2^63 seconds after 1970).  I get that it incurs more overhead having to deal with a 64 bit quantity on a 32 bit processor, but (and this is my opinion) it seems like a much cleaner solution than moving away from the standard.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bubulindo on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7679</link>
			<pubDate>Mon, 16 Jan 2012 05:38:58 +0000</pubDate>
			<dc:creator>bubulindo</dc:creator>
			<guid isPermaLink="false">7679@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ok... &#60;/p&#62;
&#60;p&#62;I got the juice out of the newlib for the mktime and localtime, took the timezone support away to make the footprint smaller and at least localtime is working properly. &#60;/p&#62;
&#60;p&#62;The downside is that my code files look like down town Mogadishu. It'll take some time to clean up, test and release, but it's a good sign. I also didn't had to use any of the standard libraries. :)&#60;/p&#62;
&#60;p&#62;One thing that I need to think about is the support for dates before Epoch... if I could use the counting variable as unsigned and set the &#34;new Epoch&#34; to say 2010, would be nice.&#60;br /&#62;
What do you guys think?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bubulindo on "Including time.h from a library."</title>
			<link>http://forums.leaflabs.com/topic.php?id=1277#post-7670</link>
			<pubDate>Sun, 15 Jan 2012 19:55:05 +0000</pubDate>
			<dc:creator>bubulindo</dc:creator>
			<guid isPermaLink="false">7670@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, same error. &#60;/p&#62;
&#60;p&#62;It may be my include order maybe, or something to do with the include directories. &#60;/p&#62;
&#60;p&#62;I downloaded the newlib and I can get the conversion functions and time_t/struct tm definition in the .h file. &#60;/p&#62;
&#60;p&#62;I'll get started on that back home.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
