<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Time is easy (hours*3600 + mins*60 + secs), but date is tricky.</div><div><br></div>How about this: <a href="http://aa.usno.navy.mil/faq/docs/JD_Formula.php">http://aa.usno.navy.mil/faq/docs/JD_Formula.php</a><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, tahoma, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; margin-top: 1.5em; margin-right: 1.5em; margin-bottom: 2em; margin-left: 0px; background-color: rgb(204, 204, 204); position: static; z-index: auto; "><code>    <span class="blue" style="color: blue; ">INTEGER FUNCTION</span> JD <span class="red" style="color: red; ">(</span>YEAR,MONTH,DAY<span class="red" style="color: red; ">)</span><br><div class="seagreen" style="color: rgb(46, 139, 87); ">C<br>C---COMPUTES THE JULIAN DATE (JD) GIVEN A GREGORIAN CALENDAR<br>C   DATE (YEAR,MONTH,DAY).<br>C<br></div>    <span class="blue" style="color: blue; ">INTEGER</span> YEAR,MONTH,DAY,I,J,K<br><span class="seagreen" style="color: rgb(46, 139, 87); ">C</span><br>    I= YEAR<br>    J= MONTH<br>    K= DAY<br><span class="seagreen" style="color: rgb(46, 139, 87); ">C</span><br>    JD= K-32075+1461*<span class="red" style="color: red; ">(</span>I+4800+<span class="red" style="color: red; ">(</span>J-14<span class="red" style="color: red; ">)</span>/12<span class="red" style="color: red; ">)</span>/4+367*<span class="red" style="color: red; ">(</span>J-2-<span class="red" style="color: red; ">(</span>J-14<span class="red" style="color: red; ">)</span>/12*12<span class="red" style="color: red; ">)</span><br>   2    /12-3*<span class="red" style="color: red; ">(</span><span class="red" style="color: red; ">(</span>I+4900+<span class="red" style="color: red; ">(</span>J-14<span class="red" style="color: red; ">)</span>/12<span class="red" style="color: red; ">)</span>/100<span class="red" style="color: red; ">)</span>/4<br><span class="seagreen" style="color: rgb(46, 139, 87); ">C</span><br><div class="blue" style="color: blue; ">    RETURN<br>    END</div><div><br></div></code></div></div></blockquote><div>Fortran! Brilliant :-) I feel so nostalgic...</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 16 Apr, 2013, at 3:41 AM, Michael Balzer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Mark,<br><br>thanks for the reminder: of course, the GPS clock should be usable. In fact I already gave it a try once but had to put it back, because the C18 libs seem to lack support for time functions. So we just need to port at least the basic time functions to convert textual representation to UNIX time.<br><br>Regards,<br>Michael<br><br><br>Am 15.04.2013 02:54, schrieb Mark Webb-Johnson:<br><blockquote type="cite">Michael,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">For the clock, can we use the GPS clock? I know that some cellular networks also support time services, but I'm appalled that they are often several minutes inaccurate.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The virtual car model actually has a car_time (second counter) which is supported on the Tesla Roadster. For other cars, we could standardise this and have it periodically synced to gps time (when available).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I think the main thing we are missing is time zone offset (which tomsax was also asking for) - my concern is things like daylight savings time complicating things.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards, Mark.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 15 Apr, 2013, at 4:01 AM, Michael Balzer wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Mark, that reminds me: a clock would be nice on the next hardware to enable cron jobs on the module.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Until then, we could introduce some time info sent from the server to the car.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Nikki, this kind of charge control could also be used to sync the charge to solar panel peak output time.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Regards,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Michael<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Am 14.04.2013 13:01, schrieb Nikki Gordon-Bloomfield:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I've been thinking about this some more, and I think I've come up with a plan.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">If I could pull the IO out there and connect it to a relay driver chip, I think it could be possible to give Twizy owners the same remote on/off charge capabilities as the Tesla.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">My thoughts:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">1) use output one from OVMS to drive a relay which is NO. When the IO output from OVMS goes high, we use that to close the relay, and let power flow, turning on the charger. When it goes low, the relay opens, and the charger turns off.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">2) use a second IO on the OVMS to sense when a switch is pressed on the dash. This allows us to start/stop charging from the vehicle using a simple push-to-make switch.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">3) using a home instance of perl and OVMS client software, write a cron job which turns on the car's charging on/off at a given time every day, or have perl listen for SOC and shut off charging when we reach 80% SOC.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">My goal? To give Twizy owners the ability to use time-of-use metering to get cheaper charging of the Twizy at night-time. And also to allow users to set 80% SOC rather than 100% SOC. It would require folks to run a perl script all the time on their home computers though.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Nikki.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 2 Apr 2013, at 14:05, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net">mark@webb-johnson.net</a>> wrote:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Tricky. It is just a tap into the modem comms.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">But, there is an expansion connector on the board itself.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The part labelled "HEADER 9X2" is a standard layout for expansion plugs, or holes are there to directly solder to the board. The I/O is 5v digital on those pins, and there are quite a few spare I/O pins that you can use.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">There is also GND, +12V and +5V if you need power.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">If you have a use for this, it would be quite simple to control some of these pins on/off on command (similar to the way home link works).<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Regards, Mark.<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><PastedGraphic-1.pdf><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><20120814-boarddesign.pdf><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 2 Apr, 2013, at 8:56 PM, Nikki Gordon-Bloomfield <<a href="mailto:nikki@littlecollie.com">nikki@littlecollie.com</a>> wrote:<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Guys,<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Is there any scope for enabling IO from the diagnostic port to operate an relay, either directly or through some opto-isolators?<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Nikki.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Michael Balzer * Paradestr. 8 * D-42107 Wuppertal<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Fon 0202 / 272 2201 * Handy 0176 / 206 989 26<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><dexter.vcf>_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">OvmsDev mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">OvmsDev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br></blockquote><blockquote type="cite"><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote><br>-- <br>Michael Balzer * Paradestr. 8 * D-42107 Wuppertal<br>Fon 0202 / 272 2201 * Handy 0176 / 206 989 26<br><br><span><dexter.vcf></span>_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></div></blockquote></div><br></div></body></html>