  


<!DOCTYPE html>
<html>
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Arduino-Chronodot/Chronodot.cpp at master · Stephanie-Maks/Arduino-Chronodot · GitHub</title>
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
    <link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
    <meta name="msapplication-TileImage" content="/windows-tile.png">
    <meta name="msapplication-TileColor" content="#ffffff">

    
    
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />

    <meta content="authenticity_token" name="csrf-param" />
<meta content="csKYN11OXT4TMWpo9t5Y1uQqehI/uNIFFRzyN7eFQc4=" name="csrf-token" />

    <link href="https://a248.e.akamai.net/assets.github.com/assets/github-4af97e95c6d3eb9a566ad339560cd70651729a71.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-5fee4310cb7130fe9656cf64857b2fa600fbabd7.css" media="screen" rel="stylesheet" type="text/css" />
    


      <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-ad1b87fda705d87118448f87fb6a20bdb15bd841.js" type="text/javascript"></script>
      <script src="https://a248.e.akamai.net/assets.github.com/assets/github-17b76a7bb4da5fd9efe2367f28d59d1721c2e709.js" type="text/javascript"></script>
      
      <meta http-equiv="x-pjax-version" content="7d93bdc92ebfc8645f49e598fdaed639">

        <link data-pjax-transient rel='permalink' href='/Stephanie-Maks/Arduino-Chronodot/blob/a35c58850e71387d3facb740b36891f4b7ea0d79/Chronodot.cpp'>
    <meta property="og:title" content="Arduino-Chronodot"/>
    <meta property="og:type" content="githubog:gitrepository"/>
    <meta property="og:url" content="https://github.com/Stephanie-Maks/Arduino-Chronodot"/>
    <meta property="og:image" content="https://secure.gravatar.com/avatar/845a66294443f4790ed67cca5e404dd8?s=420&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
    <meta property="og:site_name" content="GitHub"/>
    <meta property="og:description" content="Chronodot library for the Arduino IDE. Contribute to Arduino-Chronodot development by creating an account on GitHub."/>
    <meta property="twitter:card" content="summary"/>
    <meta property="twitter:site" content="@GitHub">
    <meta property="twitter:title" content="Stephanie-Maks/Arduino-Chronodot"/>

    <meta name="description" content="Chronodot library for the Arduino IDE. Contribute to Arduino-Chronodot development by creating an account on GitHub." />

  <link href="https://github.com/Stephanie-Maks/Arduino-Chronodot/commits/master.atom" rel="alternate" title="Recent Commits to Arduino-Chronodot:master" type="application/atom+xml" />

  </head>


  <body class="logged_out page-blob macintosh vis-public env-production  ">
    <div id="wrapper">

      

      

      

      


        <div class="header header-logged-out">
          <div class="container clearfix">

            <a class="header-logo-wordmark" href="https://github.com/">
              <img alt="GitHub" class="github-logo-4x" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x.png?1360648843" />
              <img alt="GitHub" class="github-logo-4x-hover" height="30" src="https://a248.e.akamai.net/assets.github.com/images/modules/header/logov7@4x-hover.png?1360648843" />
            </a>

              
<ul class="top-nav">
    <li class="explore"><a href="https://github.com/explore">Explore GitHub</a></li>
  <li class="search"><a href="https://github.com/search">Search</a></li>
  <li class="features"><a href="https://github.com/features">Features</a></li>
    <li class="blog"><a href="https://github.com/blog">Blog</a></li>
</ul>


            <div class="header-actions">
                <a class="button primary" href="https://github.com/signup">Sign up for free</a>
              <a class="button" href="https://github.com/login?return_to=%2FStephanie-Maks%2FArduino-Chronodot%2Fblob%2Fmaster%2FChronodot.cpp">Sign in</a>
            </div>

          </div>
        </div>


      

      


            <div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
      <div class="hentry">
        
        <div class="pagehead repohead instapaper_ignore readability-menu ">
          <div class="container">
            <div class="title-actions-bar">
              


<ul class="pagehead-actions">



    <li>
      <a href="/login?return_to=%2FStephanie-Maks%2FArduino-Chronodot"
        class="minibutton js-toggler-target star-button entice tooltipped upwards"
        title="You must be signed in to use this feature" rel="nofollow">
        <span class="mini-icon mini-icon-star"></span>Star
      </a>
      <a class="social-count js-social-count" href="/Stephanie-Maks/Arduino-Chronodot/stargazers">
        8
      </a>
    </li>
    <li>
      <a href="/login?return_to=%2FStephanie-Maks%2FArduino-Chronodot"
        class="minibutton js-toggler-target fork-button entice tooltipped upwards"
        title="You must be signed in to fork a repository" rel="nofollow">
        <span class="mini-icon mini-icon-fork"></span>Fork
      </a>
      <a href="/Stephanie-Maks/Arduino-Chronodot/network" class="social-count">
        4
      </a>
    </li>
</ul>

              <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
                <span class="repo-label"><span>public</span></span>
                <span class="mega-icon mega-icon-public-repo"></span>
                <span class="author vcard">
                  <a href="/Stephanie-Maks" class="url fn" itemprop="url" rel="author">
                  <span itemprop="title">Stephanie-Maks</span>
                  </a></span> /
                <strong><a href="/Stephanie-Maks/Arduino-Chronodot" class="js-current-repository">Arduino-Chronodot</a></strong>
              </h1>
            </div>

            
  <ul class="tabs">
    <li><a href="/Stephanie-Maks/Arduino-Chronodot" class="selected" highlight="repo_source repo_downloads repo_commits repo_tags repo_branches">Code</a></li>
    <li><a href="/Stephanie-Maks/Arduino-Chronodot/network" highlight="repo_network">Network</a></li>
    <li><a href="/Stephanie-Maks/Arduino-Chronodot/pulls" highlight="repo_pulls">Pull Requests <span class='counter'>1</span></a></li>

      <li><a href="/Stephanie-Maks/Arduino-Chronodot/issues" highlight="repo_issues">Issues <span class='counter'>1</span></a></li>



    <li><a href="/Stephanie-Maks/Arduino-Chronodot/graphs" highlight="repo_graphs repo_contributors">Graphs</a></li>


  </ul>
  
<div class="tabnav">

  <span class="tabnav-right">
    <ul class="tabnav-tabs">
          <li><a href="/Stephanie-Maks/Arduino-Chronodot/tags" class="tabnav-tab" highlight="repo_tags">Tags <span class="counter blank">0</span></a></li>
    </ul>
    
  </span>

  <div class="tabnav-widget scope">


    <div class="select-menu js-menu-container js-select-menu js-branch-menu">
      <a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="master">
        <span class="mini-icon mini-icon-branch"></span>
        <i>branch:</i>
        <span class="js-select-button">master</span>
      </a>

      <div class="select-menu-modal-holder js-menu-content js-navigation-container js-select-menu-pane">

        <div class="select-menu-modal js-select-menu-pane">
          <div class="select-menu-header">
            <span class="select-menu-title">Switch branches/tags</span>
            <span class="mini-icon mini-icon-remove-close js-menu-close"></span>
          </div> <!-- /.select-menu-header -->

          <div class="select-menu-filters">
            <div class="select-menu-text-filter">
              <input type="text" id="commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
            </div>
            <div class="select-menu-tabs">
              <ul>
                <li class="select-menu-tab">
                  <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
                </li>
                <li class="select-menu-tab">
                  <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
                </li>
              </ul>
            </div><!-- /.select-menu-tabs -->
          </div><!-- /.select-menu-filters -->

          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches" data-filterable-for="commitish-filter-field" data-filterable-type="substring">


              <div class="select-menu-item js-navigation-item js-navigation-target selected">
                <span class="select-menu-item-icon mini-icon mini-icon-confirm"></span>
                <a href="/Stephanie-Maks/Arduino-Chronodot/blob/master/Chronodot.cpp" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>
              </div> <!-- /.select-menu-item -->

              <div class="select-menu-no-results js-not-filterable">Nothing to show</div>
          </div> <!-- /.select-menu-list -->


          <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags" data-filterable-for="commitish-filter-field" data-filterable-type="substring">


            <div class="select-menu-no-results js-not-filterable">Nothing to show</div>

          </div> <!-- /.select-menu-list -->

        </div> <!-- /.select-menu-modal -->
      </div> <!-- /.select-menu-modal-holder -->
    </div> <!-- /.select-menu -->

  </div> <!-- /.scope -->

  <ul class="tabnav-tabs">
    <li><a href="/Stephanie-Maks/Arduino-Chronodot" class="selected tabnav-tab" highlight="repo_source">Files</a></li>
    <li><a href="/Stephanie-Maks/Arduino-Chronodot/commits/master" class="tabnav-tab" highlight="repo_commits">Commits</a></li>
    <li><a href="/Stephanie-Maks/Arduino-Chronodot/branches" class="tabnav-tab" highlight="repo_branches" rel="nofollow">Branches <span class="counter ">1</span></a></li>
  </ul>

</div>

  
  
  


            
          </div>
        </div><!-- /.repohead -->

        <div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
          


<!-- blob contrib key: blob_contributors:v21:5c8cdf8611e7a1c87d74dea565d0d268 -->
<!-- blob contrib frag key: views10/v8/blob_contributors:v21:5c8cdf8611e7a1c87d74dea565d0d268 -->


<div id="slider">
    <div class="frame-meta">

      <p title="This is a placeholder element" class="js-history-link-replace hidden"></p>

        <div class="breadcrumb">
          <span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/Stephanie-Maks/Arduino-Chronodot" class="js-slide-to" data-branch="master" data-direction="back" itemscope="url"><span itemprop="title">Arduino-Chronodot</span></a></span></span><span class="separator"> / </span><strong class="final-path">Chronodot.cpp</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="Chronodot.cpp" data-copied-hint="copied!" title="copy to clipboard"><span class="mini-icon mini-icon-clipboard"></span></span>
        </div>

      <a href="/Stephanie-Maks/Arduino-Chronodot/find/master" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>


        <div class="commit commit-loader file-history-tease js-deferred-content" data-url="/Stephanie-Maks/Arduino-Chronodot/contributors/master/Chronodot.cpp">
          Fetching contributors…

          <div class="participation">
            <p class="loader-loading"><img alt="Octocat-spinner-32-eaf2f5" height="16" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32-EAF2F5.gif?1360648843" width="16" /></p>
            <p class="loader-error">Cannot retrieve contributors at this time</p>
          </div>
        </div>

    </div><!-- ./.frame-meta -->

    <div class="frames">
      <div class="frame" data-permalink-url="/Stephanie-Maks/Arduino-Chronodot/blob/a35c58850e71387d3facb740b36891f4b7ea0d79/Chronodot.cpp" data-title="Arduino-Chronodot/Chronodot.cpp at master · Stephanie-Maks/Arduino-Chronodot · GitHub" data-type="blob">

        <div id="files" class="bubble">
          <div class="file">
            <div class="meta">
              <div class="info">
                <span class="icon"><b class="mini-icon mini-icon-text-file"></b></span>
                <span class="mode" title="File Mode">executable file</span>
                  <span>264 lines (233 sloc)</span>
                <span>7.181 kb</span>
              </div>
              <div class="actions">
                <div class="button-group">
                      <a class="minibutton js-entice" href=""
                         data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
                  <a href="/Stephanie-Maks/Arduino-Chronodot/raw/master/Chronodot.cpp" class="button minibutton " id="raw-url">Raw</a>
                    <a href="/Stephanie-Maks/Arduino-Chronodot/blame/master/Chronodot.cpp" class="button minibutton ">Blame</a>
                  <a href="/Stephanie-Maks/Arduino-Chronodot/commits/master/Chronodot.cpp" class="button minibutton " rel="nofollow">History</a>
                </div><!-- /.button-group -->
              </div><!-- /.actions -->

            </div>
                <div class="data type-c js-blob-data">
      <table cellpadding="0" cellspacing="0" class="lines">
        <tr>
          <td>
            <pre class="line_numbers"><span id="L1" rel="#L1">1</span>
<span id="L2" rel="#L2">2</span>
<span id="L3" rel="#L3">3</span>
<span id="L4" rel="#L4">4</span>
<span id="L5" rel="#L5">5</span>
<span id="L6" rel="#L6">6</span>
<span id="L7" rel="#L7">7</span>
<span id="L8" rel="#L8">8</span>
<span id="L9" rel="#L9">9</span>
<span id="L10" rel="#L10">10</span>
<span id="L11" rel="#L11">11</span>
<span id="L12" rel="#L12">12</span>
<span id="L13" rel="#L13">13</span>
<span id="L14" rel="#L14">14</span>
<span id="L15" rel="#L15">15</span>
<span id="L16" rel="#L16">16</span>
<span id="L17" rel="#L17">17</span>
<span id="L18" rel="#L18">18</span>
<span id="L19" rel="#L19">19</span>
<span id="L20" rel="#L20">20</span>
<span id="L21" rel="#L21">21</span>
<span id="L22" rel="#L22">22</span>
<span id="L23" rel="#L23">23</span>
<span id="L24" rel="#L24">24</span>
<span id="L25" rel="#L25">25</span>
<span id="L26" rel="#L26">26</span>
<span id="L27" rel="#L27">27</span>
<span id="L28" rel="#L28">28</span>
<span id="L29" rel="#L29">29</span>
<span id="L30" rel="#L30">30</span>
<span id="L31" rel="#L31">31</span>
<span id="L32" rel="#L32">32</span>
<span id="L33" rel="#L33">33</span>
<span id="L34" rel="#L34">34</span>
<span id="L35" rel="#L35">35</span>
<span id="L36" rel="#L36">36</span>
<span id="L37" rel="#L37">37</span>
<span id="L38" rel="#L38">38</span>
<span id="L39" rel="#L39">39</span>
<span id="L40" rel="#L40">40</span>
<span id="L41" rel="#L41">41</span>
<span id="L42" rel="#L42">42</span>
<span id="L43" rel="#L43">43</span>
<span id="L44" rel="#L44">44</span>
<span id="L45" rel="#L45">45</span>
<span id="L46" rel="#L46">46</span>
<span id="L47" rel="#L47">47</span>
<span id="L48" rel="#L48">48</span>
<span id="L49" rel="#L49">49</span>
<span id="L50" rel="#L50">50</span>
<span id="L51" rel="#L51">51</span>
<span id="L52" rel="#L52">52</span>
<span id="L53" rel="#L53">53</span>
<span id="L54" rel="#L54">54</span>
<span id="L55" rel="#L55">55</span>
<span id="L56" rel="#L56">56</span>
<span id="L57" rel="#L57">57</span>
<span id="L58" rel="#L58">58</span>
<span id="L59" rel="#L59">59</span>
<span id="L60" rel="#L60">60</span>
<span id="L61" rel="#L61">61</span>
<span id="L62" rel="#L62">62</span>
<span id="L63" rel="#L63">63</span>
<span id="L64" rel="#L64">64</span>
<span id="L65" rel="#L65">65</span>
<span id="L66" rel="#L66">66</span>
<span id="L67" rel="#L67">67</span>
<span id="L68" rel="#L68">68</span>
<span id="L69" rel="#L69">69</span>
<span id="L70" rel="#L70">70</span>
<span id="L71" rel="#L71">71</span>
<span id="L72" rel="#L72">72</span>
<span id="L73" rel="#L73">73</span>
<span id="L74" rel="#L74">74</span>
<span id="L75" rel="#L75">75</span>
<span id="L76" rel="#L76">76</span>
<span id="L77" rel="#L77">77</span>
<span id="L78" rel="#L78">78</span>
<span id="L79" rel="#L79">79</span>
<span id="L80" rel="#L80">80</span>
<span id="L81" rel="#L81">81</span>
<span id="L82" rel="#L82">82</span>
<span id="L83" rel="#L83">83</span>
<span id="L84" rel="#L84">84</span>
<span id="L85" rel="#L85">85</span>
<span id="L86" rel="#L86">86</span>
<span id="L87" rel="#L87">87</span>
<span id="L88" rel="#L88">88</span>
<span id="L89" rel="#L89">89</span>
<span id="L90" rel="#L90">90</span>
<span id="L91" rel="#L91">91</span>
<span id="L92" rel="#L92">92</span>
<span id="L93" rel="#L93">93</span>
<span id="L94" rel="#L94">94</span>
<span id="L95" rel="#L95">95</span>
<span id="L96" rel="#L96">96</span>
<span id="L97" rel="#L97">97</span>
<span id="L98" rel="#L98">98</span>
<span id="L99" rel="#L99">99</span>
<span id="L100" rel="#L100">100</span>
<span id="L101" rel="#L101">101</span>
<span id="L102" rel="#L102">102</span>
<span id="L103" rel="#L103">103</span>
<span id="L104" rel="#L104">104</span>
<span id="L105" rel="#L105">105</span>
<span id="L106" rel="#L106">106</span>
<span id="L107" rel="#L107">107</span>
<span id="L108" rel="#L108">108</span>
<span id="L109" rel="#L109">109</span>
<span id="L110" rel="#L110">110</span>
<span id="L111" rel="#L111">111</span>
<span id="L112" rel="#L112">112</span>
<span id="L113" rel="#L113">113</span>
<span id="L114" rel="#L114">114</span>
<span id="L115" rel="#L115">115</span>
<span id="L116" rel="#L116">116</span>
<span id="L117" rel="#L117">117</span>
<span id="L118" rel="#L118">118</span>
<span id="L119" rel="#L119">119</span>
<span id="L120" rel="#L120">120</span>
<span id="L121" rel="#L121">121</span>
<span id="L122" rel="#L122">122</span>
<span id="L123" rel="#L123">123</span>
<span id="L124" rel="#L124">124</span>
<span id="L125" rel="#L125">125</span>
<span id="L126" rel="#L126">126</span>
<span id="L127" rel="#L127">127</span>
<span id="L128" rel="#L128">128</span>
<span id="L129" rel="#L129">129</span>
<span id="L130" rel="#L130">130</span>
<span id="L131" rel="#L131">131</span>
<span id="L132" rel="#L132">132</span>
<span id="L133" rel="#L133">133</span>
<span id="L134" rel="#L134">134</span>
<span id="L135" rel="#L135">135</span>
<span id="L136" rel="#L136">136</span>
<span id="L137" rel="#L137">137</span>
<span id="L138" rel="#L138">138</span>
<span id="L139" rel="#L139">139</span>
<span id="L140" rel="#L140">140</span>
<span id="L141" rel="#L141">141</span>
<span id="L142" rel="#L142">142</span>
<span id="L143" rel="#L143">143</span>
<span id="L144" rel="#L144">144</span>
<span id="L145" rel="#L145">145</span>
<span id="L146" rel="#L146">146</span>
<span id="L147" rel="#L147">147</span>
<span id="L148" rel="#L148">148</span>
<span id="L149" rel="#L149">149</span>
<span id="L150" rel="#L150">150</span>
<span id="L151" rel="#L151">151</span>
<span id="L152" rel="#L152">152</span>
<span id="L153" rel="#L153">153</span>
<span id="L154" rel="#L154">154</span>
<span id="L155" rel="#L155">155</span>
<span id="L156" rel="#L156">156</span>
<span id="L157" rel="#L157">157</span>
<span id="L158" rel="#L158">158</span>
<span id="L159" rel="#L159">159</span>
<span id="L160" rel="#L160">160</span>
<span id="L161" rel="#L161">161</span>
<span id="L162" rel="#L162">162</span>
<span id="L163" rel="#L163">163</span>
<span id="L164" rel="#L164">164</span>
<span id="L165" rel="#L165">165</span>
<span id="L166" rel="#L166">166</span>
<span id="L167" rel="#L167">167</span>
<span id="L168" rel="#L168">168</span>
<span id="L169" rel="#L169">169</span>
<span id="L170" rel="#L170">170</span>
<span id="L171" rel="#L171">171</span>
<span id="L172" rel="#L172">172</span>
<span id="L173" rel="#L173">173</span>
<span id="L174" rel="#L174">174</span>
<span id="L175" rel="#L175">175</span>
<span id="L176" rel="#L176">176</span>
<span id="L177" rel="#L177">177</span>
<span id="L178" rel="#L178">178</span>
<span id="L179" rel="#L179">179</span>
<span id="L180" rel="#L180">180</span>
<span id="L181" rel="#L181">181</span>
<span id="L182" rel="#L182">182</span>
<span id="L183" rel="#L183">183</span>
<span id="L184" rel="#L184">184</span>
<span id="L185" rel="#L185">185</span>
<span id="L186" rel="#L186">186</span>
<span id="L187" rel="#L187">187</span>
<span id="L188" rel="#L188">188</span>
<span id="L189" rel="#L189">189</span>
<span id="L190" rel="#L190">190</span>
<span id="L191" rel="#L191">191</span>
<span id="L192" rel="#L192">192</span>
<span id="L193" rel="#L193">193</span>
<span id="L194" rel="#L194">194</span>
<span id="L195" rel="#L195">195</span>
<span id="L196" rel="#L196">196</span>
<span id="L197" rel="#L197">197</span>
<span id="L198" rel="#L198">198</span>
<span id="L199" rel="#L199">199</span>
<span id="L200" rel="#L200">200</span>
<span id="L201" rel="#L201">201</span>
<span id="L202" rel="#L202">202</span>
<span id="L203" rel="#L203">203</span>
<span id="L204" rel="#L204">204</span>
<span id="L205" rel="#L205">205</span>
<span id="L206" rel="#L206">206</span>
<span id="L207" rel="#L207">207</span>
<span id="L208" rel="#L208">208</span>
<span id="L209" rel="#L209">209</span>
<span id="L210" rel="#L210">210</span>
<span id="L211" rel="#L211">211</span>
<span id="L212" rel="#L212">212</span>
<span id="L213" rel="#L213">213</span>
<span id="L214" rel="#L214">214</span>
<span id="L215" rel="#L215">215</span>
<span id="L216" rel="#L216">216</span>
<span id="L217" rel="#L217">217</span>
<span id="L218" rel="#L218">218</span>
<span id="L219" rel="#L219">219</span>
<span id="L220" rel="#L220">220</span>
<span id="L221" rel="#L221">221</span>
<span id="L222" rel="#L222">222</span>
<span id="L223" rel="#L223">223</span>
<span id="L224" rel="#L224">224</span>
<span id="L225" rel="#L225">225</span>
<span id="L226" rel="#L226">226</span>
<span id="L227" rel="#L227">227</span>
<span id="L228" rel="#L228">228</span>
<span id="L229" rel="#L229">229</span>
<span id="L230" rel="#L230">230</span>
<span id="L231" rel="#L231">231</span>
<span id="L232" rel="#L232">232</span>
<span id="L233" rel="#L233">233</span>
<span id="L234" rel="#L234">234</span>
<span id="L235" rel="#L235">235</span>
<span id="L236" rel="#L236">236</span>
<span id="L237" rel="#L237">237</span>
<span id="L238" rel="#L238">238</span>
<span id="L239" rel="#L239">239</span>
<span id="L240" rel="#L240">240</span>
<span id="L241" rel="#L241">241</span>
<span id="L242" rel="#L242">242</span>
<span id="L243" rel="#L243">243</span>
<span id="L244" rel="#L244">244</span>
<span id="L245" rel="#L245">245</span>
<span id="L246" rel="#L246">246</span>
<span id="L247" rel="#L247">247</span>
<span id="L248" rel="#L248">248</span>
<span id="L249" rel="#L249">249</span>
<span id="L250" rel="#L250">250</span>
<span id="L251" rel="#L251">251</span>
<span id="L252" rel="#L252">252</span>
<span id="L253" rel="#L253">253</span>
<span id="L254" rel="#L254">254</span>
<span id="L255" rel="#L255">255</span>
<span id="L256" rel="#L256">256</span>
<span id="L257" rel="#L257">257</span>
<span id="L258" rel="#L258">258</span>
<span id="L259" rel="#L259">259</span>
<span id="L260" rel="#L260">260</span>
<span id="L261" rel="#L261">261</span>
<span id="L262" rel="#L262">262</span>
<span id="L263" rel="#L263">263</span>
</pre>
          </td>
          <td width="100%">
                  <div class="highlight"><pre><div class='line' id='LC1'><span class="c1">// Code by JeeLabs http://news.jeelabs.org/code/</span></div><div class='line' id='LC2'><span class="c1">// Released to the public domain! Enjoy!</span></div><div class='line' id='LC3'><span class="c1">//</span></div><div class='line' id='LC4'><span class="c1">// Modified for Chronodot / DS3132 with </span></div><div class='line' id='LC5'><span class="c1">//   temperature data by Stephanie Maks</span></div><div class='line' id='LC6'><span class="c1">//   http://planetstephanie.net/</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'><span class="cp">#include &lt;Wire.h&gt;</span></div><div class='line' id='LC10'><span class="cp">#include &lt;avr/pgmspace.h&gt;</span></div><div class='line' id='LC11'><span class="cp">#include &quot;Chronodot.h&quot;</span></div><div class='line' id='LC12'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC13'>&nbsp;&nbsp;<span class="err">#</span><span class="n">include</span> <span class="s">&quot;Arduino.h&quot;</span></div><div class='line' id='LC14'><span class="cp">#else</span></div><div class='line' id='LC15'>&nbsp;&nbsp;<span class="err">#</span><span class="n">include</span> <span class="s">&quot;WProgram.h&quot;</span></div><div class='line' id='LC16'><span class="cp">#endif</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="cp">#define CHRONODOT_ADDRESS 0x68</span></div><div class='line' id='LC19'><span class="cp">#define SECONDS_PER_DAY 86400L</span></div><div class='line' id='LC20'><br/></div><div class='line' id='LC21'><span class="cp">#define SECONDS_FROM_1970_TO_2000 946684800</span></div><div class='line' id='LC22'><br/></div><div class='line' id='LC23'><span class="c1">////////////////////////////////////////////////////////////////////////////////</span></div><div class='line' id='LC24'><span class="c1">// utility code, some of this could be exposed in the DateTime API if needed</span></div><div class='line' id='LC25'><br/></div><div class='line' id='LC26'><span class="k">static</span> <span class="kt">uint8_t</span> <span class="n">daysInMonth</span> <span class="p">[]</span> <span class="n">PROGMEM</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">31</span><span class="p">,</span><span class="mi">28</span><span class="p">,</span><span class="mi">31</span><span class="p">,</span><span class="mi">30</span><span class="p">,</span><span class="mi">31</span><span class="p">,</span><span class="mi">30</span><span class="p">,</span><span class="mi">31</span><span class="p">,</span><span class="mi">31</span><span class="p">,</span><span class="mi">30</span><span class="p">,</span><span class="mi">31</span><span class="p">,</span><span class="mi">30</span><span class="p">,</span><span class="mi">31</span> <span class="p">};</span></div><div class='line' id='LC27'><br/></div><div class='line' id='LC28'><span class="c1">// number of days since 2000/01/01, valid for 2001..2099</span></div><div class='line' id='LC29'><span class="k">static</span> <span class="kt">uint16_t</span> <span class="nf">date2days</span><span class="p">(</span><span class="kt">uint16_t</span> <span class="n">y</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">m</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">d</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">y</span> <span class="o">&gt;=</span> <span class="mi">2000</span><span class="p">)</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">y</span> <span class="o">-=</span> <span class="mi">2000</span><span class="p">;</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">days</span> <span class="o">=</span> <span class="n">d</span><span class="p">;</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="kt">uint8_t</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">m</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">days</span> <span class="o">+=</span> <span class="n">pgm_read_byte</span><span class="p">(</span><span class="n">daysInMonth</span> <span class="o">+</span> <span class="n">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">m</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">&amp;&amp;</span> <span class="n">y</span> <span class="o">%</span> <span class="mi">4</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">++</span><span class="n">days</span><span class="p">;</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="n">days</span> <span class="o">+</span> <span class="mi">365</span> <span class="o">*</span> <span class="n">y</span> <span class="o">+</span> <span class="p">(</span><span class="n">y</span> <span class="o">+</span> <span class="mi">3</span><span class="p">)</span> <span class="o">/</span> <span class="mi">4</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span></div><div class='line' id='LC38'><span class="p">}</span></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'><span class="k">static</span> <span class="kt">long</span> <span class="nf">time2long</span><span class="p">(</span><span class="kt">uint16_t</span> <span class="n">days</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">h</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">m</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">s</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="p">((</span><span class="n">days</span> <span class="o">*</span> <span class="mi">24L</span> <span class="o">+</span> <span class="n">h</span><span class="p">)</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">+</span> <span class="n">m</span><span class="p">)</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">+</span> <span class="n">s</span><span class="p">;</span></div><div class='line' id='LC42'><span class="p">}</span></div><div class='line' id='LC43'><br/></div><div class='line' id='LC44'><span class="c1">////////////////////////////////////////////////////////////////////////////////</span></div><div class='line' id='LC45'><span class="c1">// DateTime implementation - ignores time zones and DST changes</span></div><div class='line' id='LC46'><span class="c1">// NOTE: also ignores leap seconds, see http://en.wikipedia.org/wiki/Leap_second</span></div><div class='line' id='LC47'><br/></div><div class='line' id='LC48'><span class="n">DateTime</span><span class="o">::</span><span class="n">DateTime</span> <span class="p">(</span><span class="kt">uint32_t</span> <span class="n">t</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC49'>&nbsp;&nbsp;<span class="n">t</span> <span class="o">-=</span> <span class="n">SECONDS_FROM_1970_TO_2000</span><span class="p">;</span>    <span class="c1">// bring to 2000 timestamp from 1970</span></div><div class='line' id='LC50'><br/></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ss</span> <span class="o">=</span> <span class="n">t</span> <span class="o">%</span> <span class="mi">60</span><span class="p">;</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">t</span> <span class="o">/=</span> <span class="mi">60</span><span class="p">;</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">mm</span> <span class="o">=</span> <span class="n">t</span> <span class="o">%</span> <span class="mi">60</span><span class="p">;</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">t</span> <span class="o">/=</span> <span class="mi">60</span><span class="p">;</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">hh</span> <span class="o">=</span> <span class="n">t</span> <span class="o">%</span> <span class="mi">24</span><span class="p">;</span></div><div class='line' id='LC56'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">days</span> <span class="o">=</span> <span class="n">t</span> <span class="o">/</span> <span class="mi">24</span><span class="p">;</span></div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">leap</span><span class="p">;</span></div><div class='line' id='LC58'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="n">yOff</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="p">;</span> <span class="o">++</span><span class="n">yOff</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC59'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">leap</span> <span class="o">=</span> <span class="n">yOff</span> <span class="o">%</span> <span class="mi">4</span> <span class="o">==</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">&lt;</span> <span class="mi">365</span> <span class="o">+</span> <span class="n">leap</span><span class="p">)</span></div><div class='line' id='LC61'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">break</span><span class="p">;</span></div><div class='line' id='LC62'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">days</span> <span class="o">-=</span> <span class="mi">365</span> <span class="o">+</span> <span class="n">leap</span><span class="p">;</span></div><div class='line' id='LC63'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC64'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for</span> <span class="p">(</span><span class="n">m</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="p">;</span> <span class="o">++</span><span class="n">m</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC65'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">daysPerMonth</span> <span class="o">=</span> <span class="n">pgm_read_byte</span><span class="p">(</span><span class="n">daysInMonth</span> <span class="o">+</span> <span class="n">m</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></div><div class='line' id='LC66'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">leap</span> <span class="o">&amp;&amp;</span> <span class="n">m</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span></div><div class='line' id='LC67'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">++</span><span class="n">daysPerMonth</span><span class="p">;</span></div><div class='line' id='LC68'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">&lt;</span> <span class="n">daysPerMonth</span><span class="p">)</span></div><div class='line' id='LC69'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">break</span><span class="p">;</span></div><div class='line' id='LC70'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">days</span> <span class="o">-=</span> <span class="n">daysPerMonth</span><span class="p">;</span></div><div class='line' id='LC71'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC72'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">d</span> <span class="o">=</span> <span class="n">days</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span></div><div class='line' id='LC73'><span class="p">}</span></div><div class='line' id='LC74'><br/></div><div class='line' id='LC75'><span class="n">DateTime</span><span class="o">::</span><span class="n">DateTime</span> <span class="p">(</span><span class="kt">uint16_t</span> <span class="n">year</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">month</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">day</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">hour</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">min</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">sec</span><span class="p">,</span> <span class="kt">int</span> <span class="n">tempF</span><span class="p">,</span> <span class="kt">float</span> <span class="n">tempC</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC76'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">year</span> <span class="o">&gt;=</span> <span class="mi">2000</span><span class="p">)</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">year</span> <span class="o">-=</span> <span class="mi">2000</span><span class="p">;</span></div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">yOff</span> <span class="o">=</span> <span class="n">year</span><span class="p">;</span></div><div class='line' id='LC79'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">m</span> <span class="o">=</span> <span class="n">month</span><span class="p">;</span></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">d</span> <span class="o">=</span> <span class="n">day</span><span class="p">;</span></div><div class='line' id='LC81'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">hh</span> <span class="o">=</span> <span class="n">hour</span><span class="p">;</span></div><div class='line' id='LC82'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">mm</span> <span class="o">=</span> <span class="n">min</span><span class="p">;</span></div><div class='line' id='LC83'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ss</span> <span class="o">=</span> <span class="n">sec</span><span class="p">;</span></div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ttf</span> <span class="o">=</span> <span class="n">tempF</span><span class="p">;</span></div><div class='line' id='LC85'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ttc</span> <span class="o">=</span> <span class="n">tempC</span><span class="p">;</span></div><div class='line' id='LC86'><span class="p">}</span></div><div class='line' id='LC87'><br/></div><div class='line' id='LC88'><span class="k">static</span> <span class="kt">uint8_t</span> <span class="n">conv2d</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">p</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC89'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">v</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC90'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="sc">&#39;0&#39;</span> <span class="o">&lt;=</span> <span class="o">*</span><span class="n">p</span> <span class="o">&amp;&amp;</span> <span class="o">*</span><span class="n">p</span> <span class="o">&lt;=</span> <span class="sc">&#39;9&#39;</span><span class="p">)</span></div><div class='line' id='LC91'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">v</span> <span class="o">=</span> <span class="o">*</span><span class="n">p</span> <span class="o">-</span> <span class="sc">&#39;0&#39;</span><span class="p">;</span></div><div class='line' id='LC92'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="mi">10</span> <span class="o">*</span> <span class="n">v</span> <span class="o">+</span> <span class="o">*++</span><span class="n">p</span> <span class="o">-</span> <span class="sc">&#39;0&#39;</span><span class="p">;</span></div><div class='line' id='LC93'><span class="p">}</span></div><div class='line' id='LC94'><br/></div><div class='line' id='LC95'><span class="c1">// A convenient constructor for using &quot;the compiler&#39;s time&quot;:</span></div><div class='line' id='LC96'><span class="c1">//   DateTime now (__DATE__, __TIME__);</span></div><div class='line' id='LC97'><span class="c1">// NOTE: using PSTR would further reduce the RAM footprint</span></div><div class='line' id='LC98'><span class="n">DateTime</span><span class="o">::</span><span class="n">DateTime</span> <span class="p">(</span><span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">date</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">time</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC99'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// sample input: date = &quot;Dec 26 2009&quot;, time = &quot;12:34:56&quot;</span></div><div class='line' id='LC100'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">yOff</span> <span class="o">=</span> <span class="n">conv2d</span><span class="p">(</span><span class="n">date</span> <span class="o">+</span> <span class="mi">9</span><span class="p">);</span></div><div class='line' id='LC101'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec </span></div><div class='line' id='LC102'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">switch</span> <span class="p">(</span><span class="n">date</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="p">{</span></div><div class='line' id='LC103'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;J&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="n">date</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;a&#39;</span> <span class="o">?</span> <span class="mi">1</span> <span class="o">:</span> <span class="n">m</span> <span class="o">=</span> <span class="n">date</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;n&#39;</span> <span class="o">?</span> <span class="mi">6</span> <span class="o">:</span> <span class="mi">7</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC104'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;F&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC105'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;A&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="n">date</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;r&#39;</span> <span class="o">?</span> <span class="mi">4</span> <span class="o">:</span> <span class="mi">8</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC106'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;M&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="n">date</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;r&#39;</span> <span class="o">?</span> <span class="mi">3</span> <span class="o">:</span> <span class="mi">5</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC107'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;S&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="mi">9</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC108'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;O&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC109'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;N&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="mi">11</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC110'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="sc">&#39;D&#39;</span>: <span class="n">m</span> <span class="o">=</span> <span class="mi">12</span><span class="p">;</span> <span class="k">break</span><span class="p">;</span></div><div class='line' id='LC111'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC112'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">d</span> <span class="o">=</span> <span class="n">conv2d</span><span class="p">(</span><span class="n">date</span> <span class="o">+</span> <span class="mi">4</span><span class="p">);</span></div><div class='line' id='LC113'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">hh</span> <span class="o">=</span> <span class="n">conv2d</span><span class="p">(</span><span class="n">time</span><span class="p">);</span></div><div class='line' id='LC114'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">mm</span> <span class="o">=</span> <span class="n">conv2d</span><span class="p">(</span><span class="n">time</span> <span class="o">+</span> <span class="mi">3</span><span class="p">);</span></div><div class='line' id='LC115'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ss</span> <span class="o">=</span> <span class="n">conv2d</span><span class="p">(</span><span class="n">time</span> <span class="o">+</span> <span class="mi">6</span><span class="p">);</span></div><div class='line' id='LC116'><span class="p">}</span></div><div class='line' id='LC117'><br/></div><div class='line' id='LC118'><span class="kt">uint8_t</span> <span class="n">DateTime</span><span class="o">::</span><span class="n">dayOfWeek</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span>    </div><div class='line' id='LC119'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">day</span> <span class="o">=</span> <span class="n">date2days</span><span class="p">(</span><span class="n">yOff</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">d</span><span class="p">);</span></div><div class='line' id='LC120'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="p">(</span><span class="n">day</span> <span class="o">+</span> <span class="mi">6</span><span class="p">)</span> <span class="o">%</span> <span class="mi">7</span><span class="p">;</span> <span class="c1">// Jan 1, 2000 is a Saturday, i.e. returns 6</span></div><div class='line' id='LC121'><span class="p">}</span></div><div class='line' id='LC122'><br/></div><div class='line' id='LC123'><span class="kt">long</span> <span class="n">DateTime</span><span class="o">::</span><span class="n">secondstime</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span></div><div class='line' id='LC124'>&nbsp;&nbsp;<span class="kt">long</span> <span class="n">t</span><span class="p">;</span></div><div class='line' id='LC125'>&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">days</span> <span class="o">=</span> <span class="n">date2days</span><span class="p">(</span><span class="n">yOff</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">d</span><span class="p">);</span></div><div class='line' id='LC126'>&nbsp;&nbsp;<span class="n">t</span> <span class="o">=</span> <span class="n">time2long</span><span class="p">(</span><span class="n">days</span><span class="p">,</span> <span class="n">hh</span><span class="p">,</span> <span class="n">mm</span><span class="p">,</span> <span class="n">ss</span><span class="p">);</span></div><div class='line' id='LC127'>&nbsp;&nbsp;<span class="k">return</span> <span class="n">t</span><span class="p">;</span></div><div class='line' id='LC128'><span class="p">}</span></div><div class='line' id='LC129'><br/></div><div class='line' id='LC130'><span class="kt">uint32_t</span> <span class="n">DateTime</span><span class="o">::</span><span class="n">unixtime</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span></div><div class='line' id='LC131'>&nbsp;&nbsp;<span class="kt">uint32_t</span> <span class="n">t</span><span class="p">;</span></div><div class='line' id='LC132'>&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">days</span> <span class="o">=</span> <span class="n">date2days</span><span class="p">(</span><span class="n">yOff</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">d</span><span class="p">);</span></div><div class='line' id='LC133'>&nbsp;&nbsp;<span class="n">t</span> <span class="o">=</span> <span class="n">time2long</span><span class="p">(</span><span class="n">days</span><span class="p">,</span> <span class="n">hh</span><span class="p">,</span> <span class="n">mm</span><span class="p">,</span> <span class="n">ss</span><span class="p">);</span></div><div class='line' id='LC134'>&nbsp;&nbsp;<span class="n">t</span> <span class="o">+=</span> <span class="n">SECONDS_FROM_1970_TO_2000</span><span class="p">;</span>  <span class="c1">// seconds from 1970 to 2000</span></div><div class='line' id='LC135'>&nbsp;&nbsp;<span class="k">return</span> <span class="n">t</span><span class="p">;</span></div><div class='line' id='LC136'><span class="p">}</span></div><div class='line' id='LC137'><br/></div><div class='line' id='LC138'><span class="c1">////////////////////////////////////////////////////////////////////////////////</span></div><div class='line' id='LC139'><span class="c1">// RTC_DS3231 implementation</span></div><div class='line' id='LC140'><br/></div><div class='line' id='LC141'><span class="k">static</span> <span class="kt">uint8_t</span> <span class="n">bcd2bin</span> <span class="p">(</span><span class="kt">uint8_t</span> <span class="n">val</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">val</span> <span class="o">-</span> <span class="mi">6</span> <span class="o">*</span> <span class="p">(</span><span class="n">val</span> <span class="o">&gt;&gt;</span> <span class="mi">4</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC142'><span class="k">static</span> <span class="kt">uint8_t</span> <span class="n">bin2bcd</span> <span class="p">(</span><span class="kt">uint8_t</span> <span class="n">val</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">val</span> <span class="o">+</span> <span class="mi">6</span> <span class="o">*</span> <span class="p">(</span><span class="n">val</span> <span class="o">/</span> <span class="mi">10</span><span class="p">);</span> <span class="p">}</span></div><div class='line' id='LC143'><br/></div><div class='line' id='LC144'><span class="kt">uint8_t</span> <span class="n">Chronodot</span><span class="o">::</span><span class="n">begin</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC145'>&nbsp;&nbsp;<span class="k">return</span> <span class="mi">1</span><span class="p">;</span></div><div class='line' id='LC146'><span class="p">}</span></div><div class='line' id='LC147'><br/></div><div class='line' id='LC148'><span class="kt">uint8_t</span> <span class="n">Chronodot</span><span class="o">::</span><span class="n">isrunning</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC149'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">beginTransmission</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">);</span></div><div class='line' id='LC150'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC151'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC152'><span class="cp">#else</span></div><div class='line' id='LC153'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC154'><span class="cp">#endif</span></div><div class='line' id='LC155'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">endTransmission</span><span class="p">();</span></div><div class='line' id='LC156'><br/></div><div class='line' id='LC157'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">requestFrom</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span></div><div class='line' id='LC158'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC159'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">ss</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">read</span><span class="p">();</span></div><div class='line' id='LC160'><span class="cp">#else</span></div><div class='line' id='LC161'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">ss</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">receive</span><span class="p">();</span></div><div class='line' id='LC162'><span class="cp">#endif</span></div><div class='line' id='LC163'>&nbsp;&nbsp;<span class="k">return</span> <span class="o">!</span><span class="p">(</span><span class="n">ss</span><span class="o">&gt;&gt;</span><span class="mi">7</span><span class="p">);</span></div><div class='line' id='LC164'><span class="p">}</span></div><div class='line' id='LC165'><br/></div><div class='line' id='LC166'><span class="kt">void</span> <span class="n">Chronodot</span><span class="o">::</span><span class="n">adjust</span><span class="p">(</span><span class="k">const</span> <span class="n">DateTime</span><span class="o">&amp;</span> <span class="n">dt</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC167'><span class="c1">// send new date &amp; time to chronodot</span></div><div class='line' id='LC168'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">beginTransmission</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">);</span></div><div class='line' id='LC169'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC170'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="mi">0</span><span class="p">);</span>							<span class="c1">// memory address</span></div><div class='line' id='LC171'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">second</span><span class="p">()));</span>				<span class="c1">// byte 0</span></div><div class='line' id='LC172'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">minute</span><span class="p">()));</span>				<span class="c1">// byte 1</span></div><div class='line' id='LC173'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">hour</span><span class="p">()));</span>					<span class="c1">// byte 2</span></div><div class='line' id='LC174'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span>							<span class="c1">// byte 3</span></div><div class='line' id='LC175'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">day</span><span class="p">()));</span>					<span class="c1">// byte 4</span></div><div class='line' id='LC176'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">month</span><span class="p">()));</span>				<span class="c1">// byte 5</span></div><div class='line' id='LC177'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">year</span><span class="p">()</span> <span class="o">-</span> <span class="mi">2000</span><span class="p">));</span>			<span class="c1">// byte 6</span></div><div class='line' id='LC178'><span class="cp">#else</span></div><div class='line' id='LC179'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span></div><div class='line' id='LC180'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">second</span><span class="p">()));</span></div><div class='line' id='LC181'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">minute</span><span class="p">()));</span></div><div class='line' id='LC182'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">hour</span><span class="p">()));</span></div><div class='line' id='LC183'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span></div><div class='line' id='LC184'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">day</span><span class="p">()));</span></div><div class='line' id='LC185'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">month</span><span class="p">()));</span></div><div class='line' id='LC186'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">bin2bcd</span><span class="p">(</span><span class="n">dt</span><span class="p">.</span><span class="n">year</span><span class="p">()</span> <span class="o">-</span> <span class="mi">2000</span><span class="p">));</span></div><div class='line' id='LC187'><span class="cp">#endif</span></div><div class='line' id='LC188'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">endTransmission</span><span class="p">();</span></div><div class='line' id='LC189'><span class="c1">// now get the control byte - we need to set bit 7 to zero</span></div><div class='line' id='LC190'>	<span class="n">Wire</span><span class="p">.</span><span class="n">beginTransmission</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">);</span></div><div class='line' id='LC191'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC192'>	<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC193'><span class="cp">#else</span></div><div class='line' id='LC194'>	<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC195'><span class="cp">#endif</span></div><div class='line' id='LC196'>	<span class="n">Wire</span><span class="p">.</span><span class="n">endTransmission</span><span class="p">();</span></div><div class='line' id='LC197'>	<span class="n">Wire</span><span class="p">.</span><span class="n">requestFrom</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span></div><div class='line' id='LC198'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC199'>	<span class="kt">uint8_t</span> <span class="n">ss</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">read</span><span class="p">();</span></div><div class='line' id='LC200'><span class="cp">#else</span></div><div class='line' id='LC201'>	<span class="kt">uint8_t</span> <span class="n">ss</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">receive</span><span class="p">();</span></div><div class='line' id='LC202'><span class="cp">#endif</span></div><div class='line' id='LC203'>	<span class="n">ss</span> <span class="o">&amp;=</span> <span class="o">~</span><span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">7</span><span class="p">);</span>				<span class="c1">// clear OSF bit</span></div><div class='line' id='LC204'>	<span class="n">Wire</span><span class="p">.</span><span class="n">beginTransmission</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">);</span></div><div class='line' id='LC205'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC206'>	<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC207'>	<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="n">ss</span><span class="p">);</span></div><div class='line' id='LC208'><span class="cp">#else</span></div><div class='line' id='LC209'>	<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mh">0x0F</span><span class="p">);</span></div><div class='line' id='LC210'>	<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">ss</span><span class="p">);</span></div><div class='line' id='LC211'><span class="cp">#endif</span></div><div class='line' id='LC212'>	<span class="n">Wire</span><span class="p">.</span><span class="n">endTransmission</span><span class="p">();</span></div><div class='line' id='LC213'><span class="p">}</span></div><div class='line' id='LC214'><br/></div><div class='line' id='LC215'><span class="n">DateTime</span> <span class="n">Chronodot</span><span class="o">::</span><span class="n">now</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC216'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">beginTransmission</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">);</span></div><div class='line' id='LC217'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC218'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">write</span><span class="p">((</span><span class="n">byte</span><span class="p">)</span><span class="mi">0</span><span class="p">);</span></div><div class='line' id='LC219'><span class="cp">#else</span></div><div class='line' id='LC220'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>	</div><div class='line' id='LC221'><span class="cp">#endif</span></div><div class='line' id='LC222'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">endTransmission</span><span class="p">();</span></div><div class='line' id='LC223'>&nbsp;&nbsp;</div><div class='line' id='LC224'>&nbsp;&nbsp;<span class="n">Wire</span><span class="p">.</span><span class="n">requestFrom</span><span class="p">(</span><span class="n">CHRONODOT_ADDRESS</span><span class="p">,</span> <span class="mi">19</span><span class="p">);</span></div><div class='line' id='LC225'>&nbsp;&nbsp;<span class="n">byte</span> <span class="n">blah</span><span class="p">[</span><span class="mi">20</span><span class="p">];</span></div><div class='line' id='LC226'>&nbsp;&nbsp;<span class="kt">int</span> <span class="n">i</span><span class="p">;</span></div><div class='line' id='LC227'>&nbsp;&nbsp;<span class="k">for</span><span class="p">(</span><span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="mi">20</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC228'><span class="cp">#if ARDUINO &gt;= 100</span></div><div class='line' id='LC229'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">blah</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">read</span><span class="p">();</span></div><div class='line' id='LC230'><span class="cp">#else</span></div><div class='line' id='LC231'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">blah</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">Wire</span><span class="p">.</span><span class="n">receive</span><span class="p">();</span></div><div class='line' id='LC232'><span class="cp">#endif</span></div><div class='line' id='LC233'>&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC234'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">ss</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&amp;</span> <span class="mh">0x7F</span><span class="p">);</span></div><div class='line' id='LC235'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">mm</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span></div><div class='line' id='LC236'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">hh</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">2</span><span class="p">]);</span></div><div class='line' id='LC237'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">d</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">4</span><span class="p">]);</span></div><div class='line' id='LC238'>&nbsp;&nbsp;<span class="kt">uint8_t</span> <span class="n">m</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">5</span><span class="p">]);</span></div><div class='line' id='LC239'>&nbsp;&nbsp;<span class="kt">uint16_t</span> <span class="n">y</span> <span class="o">=</span> <span class="n">bcd2bin</span><span class="p">(</span><span class="n">blah</span><span class="p">[</span><span class="mi">6</span><span class="p">])</span> <span class="o">+</span> <span class="mi">2000</span><span class="p">;</span></div><div class='line' id='LC240'>&nbsp;&nbsp;<span class="kt">float</span> <span class="n">ttc</span>  <span class="o">=</span> <span class="p">(</span><span class="kt">float</span><span class="p">)(</span><span class="kt">int</span><span class="p">)</span><span class="n">blah</span><span class="p">[</span><span class="mi">17</span><span class="p">];</span></div><div class='line' id='LC241'>&nbsp;&nbsp;<span class="n">byte</span> <span class="n">portion</span> <span class="o">=</span> <span class="n">blah</span><span class="p">[</span><span class="mi">18</span><span class="p">];</span></div><div class='line' id='LC242'>&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="n">portion</span> <span class="o">==</span> <span class="mi">0</span><span class="n">b01000000</span><span class="p">)</span> <span class="n">ttc</span> <span class="o">+=</span> <span class="mf">0.25</span><span class="p">;</span></div><div class='line' id='LC243'>&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="n">portion</span> <span class="o">==</span> <span class="mi">0</span><span class="n">b10000000</span><span class="p">)</span> <span class="n">ttc</span> <span class="o">+=</span> <span class="mf">0.5</span><span class="p">;</span></div><div class='line' id='LC244'>&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="n">portion</span> <span class="o">==</span> <span class="mi">0</span><span class="n">b11000000</span><span class="p">)</span> <span class="n">ttc</span> <span class="o">+=</span> <span class="mf">0.75</span><span class="p">;</span></div><div class='line' id='LC245'>&nbsp;&nbsp;<span class="kt">float</span> <span class="n">degF</span>  <span class="o">=</span> <span class="p">(((</span><span class="n">ttc</span> <span class="o">*</span> <span class="mf">9.0</span><span class="p">)</span> <span class="o">/</span> <span class="mf">5.0</span><span class="p">)</span> <span class="o">+</span> <span class="mf">32.5</span><span class="p">);</span></div><div class='line' id='LC246'>&nbsp;&nbsp;<span class="kt">int</span> <span class="n">ttf</span>  <span class="o">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">degF</span><span class="p">;</span></div><div class='line' id='LC247'>&nbsp;&nbsp;<span class="k">return</span> <span class="nf">DateTime</span> <span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">m</span><span class="p">,</span> <span class="n">d</span><span class="p">,</span> <span class="n">hh</span><span class="p">,</span> <span class="n">mm</span><span class="p">,</span> <span class="n">ss</span><span class="p">,</span> <span class="n">ttf</span><span class="p">,</span> <span class="n">ttc</span><span class="p">);</span></div><div class='line' id='LC248'><span class="p">}</span></div><div class='line' id='LC249'><br/></div><div class='line' id='LC250'><span class="c1">////////////////////////////////////////////////////////////////////////////////</span></div><div class='line' id='LC251'><span class="c1">// RTC_Millis implementation</span></div><div class='line' id='LC252'><br/></div><div class='line' id='LC253'><span class="kt">long</span> <span class="n">RTC_Millis</span><span class="o">::</span><span class="n">offset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></div><div class='line' id='LC254'><br/></div><div class='line' id='LC255'><span class="kt">void</span> <span class="n">RTC_Millis</span><span class="o">::</span><span class="n">adjust</span><span class="p">(</span><span class="k">const</span> <span class="n">DateTime</span><span class="o">&amp;</span> <span class="n">dt</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC256'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">offset</span> <span class="o">=</span> <span class="n">dt</span><span class="p">.</span><span class="n">unixtime</span><span class="p">()</span> <span class="o">-</span> <span class="n">millis</span><span class="p">()</span> <span class="o">/</span> <span class="mi">1000</span><span class="p">;</span></div><div class='line' id='LC257'><span class="p">}</span></div><div class='line' id='LC258'><br/></div><div class='line' id='LC259'><span class="n">DateTime</span> <span class="n">RTC_Millis</span><span class="o">::</span><span class="n">now</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC260'>&nbsp;&nbsp;<span class="k">return</span> <span class="p">(</span><span class="kt">uint32_t</span><span class="p">)(</span><span class="n">offset</span> <span class="o">+</span> <span class="n">millis</span><span class="p">()</span> <span class="o">/</span> <span class="mi">1000</span><span class="p">);</span></div><div class='line' id='LC261'><span class="p">}</span></div><div class='line' id='LC262'><br/></div><div class='line' id='LC263'><span class="c1">////////////////////////////////////////////////////////////////////////////////</span></div></pre></div>
          </td>
        </tr>
      </table>
  </div>

          </div>
        </div>

        <a href="#jump-to-line" rel="facebox" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
        <div id="jump-to-line" style="display:none">
          <h2>Jump to Line</h2>
          <form accept-charset="UTF-8" class="js-jump-to-line-form">
            <input class="textfield js-jump-to-line-field" type="text">
            <div class="full-button">
              <button type="submit" class="button">Go</button>
            </div>
          </form>
        </div>

      </div>
    </div>
</div>

<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
  <img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif?1360648843" height="64" width="64">
</div>


        </div>
      </div>
      <div class="context-overlay"></div>
    </div>

      <div id="footer-push"></div><!-- hack for sticky footer -->
    </div><!-- end of wrapper - hack for sticky footer -->

      <!-- footer -->
      <div id="footer">
  <div class="container clearfix">

      <dl class="footer_nav">
        <dt>GitHub</dt>
        <dd><a href="https://github.com/about">About us</a></dd>
        <dd><a href="https://github.com/blog">Blog</a></dd>
        <dd><a href="https://github.com/contact">Contact &amp; support</a></dd>
        <dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
        <dd><a href="http://status.github.com/">Site status</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Applications</dt>
        <dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
        <dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
        <dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
        <dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Services</dt>
        <dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
        <dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
        <dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
        <dd><a href="http://jobs.github.com/">Job board</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>Documentation</dt>
        <dd><a href="http://help.github.com/">GitHub Help</a></dd>
        <dd><a href="http://developer.github.com/">Developer API</a></dd>
        <dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
        <dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
      </dl>

      <dl class="footer_nav">
        <dt>More</dt>
        <dd><a href="http://training.github.com/">Training</a></dd>
        <dd><a href="https://github.com/edu">Students &amp; teachers</a></dd>
        <dd><a href="http://shop.github.com">The Shop</a></dd>
        <dd><a href="/plans">Plans &amp; pricing</a></dd>
        <dd><a href="http://octodex.github.com/">The Octodex</a></dd>
      </dl>

      <hr class="footer-divider">


    <p class="right">&copy; 2013 <span title="0.04575s from fe3.rs.github.com">GitHub</span>, Inc. All rights reserved.</p>
    <a class="left" href="https://github.com/">
      <span class="mega-icon mega-icon-invertocat"></span>
    </a>
    <ul id="legal">
        <li><a href="https://github.com/site/terms">Terms of Service</a></li>
        <li><a href="https://github.com/site/privacy">Privacy</a></li>
        <li><a href="https://github.com/security">Security</a></li>
    </ul>

  </div><!-- /.container -->

</div><!-- /.#footer -->


    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
  <div class="fullscreen-container js-fullscreen-container">
    <div class="textarea-wrap">
      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
          <div class="suggester-container">
              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
                 data-url="/Stephanie-Maks/Arduino-Chronodot/suggestions/commit">
              </div>
          </div>
    </div>
  </div>
  <div class="fullscreen-sidebar">
    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
      <span class="mega-icon mega-icon-normalscreen"></span>
    </a>
    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
      title="Switch themes">
      <span class="mini-icon mini-icon-brightness"></span>
    </a>
  </div>
</div>



    <div id="ajax-error-message" class="flash flash-error">
      <span class="mini-icon mini-icon-exclamation"></span>
      Something went wrong with that request. Please try again.
      <a href="#" class="mini-icon mini-icon-remove-close ajax-error-dismiss"></a>
    </div>

    
    
    <span id='server_response_time' data-time='0.04620' data-host='fe3'></span>
    
  </body>
</html>

