doc/TaskJuggler/TjTime.html in taskjuggler-0.1.1 vs doc/TaskJuggler/TjTime.html in taskjuggler-0.2.0

- old
+ new

@@ -169,10 +169,12 @@ <li><a href="#method-i-to_s">#to_s</a></li> <li><a href="#method-i-upto">#upto</a></li> + <li><a href="#method-i-utc">#utc</a></li> + <li><a href="#method-i-wday">#wday</a></li> <li><a href="#method-i-week">#week</a></li> <li><a href="#method-i-weekdayAndDate">#weekdayAndDate</a></li> @@ -317,16 +319,28 @@ <li><a href="../TaskJuggler/HTMLElements.html">TaskJuggler::HTMLElements</a></li> <li><a href="../TaskJuggler/HTMLGraphics.html">TaskJuggler::HTMLGraphics</a></li> + <li><a href="../TaskJuggler/ICalReport.html">TaskJuggler::ICalReport</a></li> + + <li><a href="../TaskJuggler/ICalendar.html">TaskJuggler::ICalendar</a></li> + + <li><a href="../TaskJuggler/ICalendar/Component.html">TaskJuggler::ICalendar::Component</a></li> + + <li><a href="../TaskJuggler/ICalendar/Event.html">TaskJuggler::ICalendar::Event</a></li> + + <li><a href="../TaskJuggler/ICalendar/Journal.html">TaskJuggler::ICalendar::Journal</a></li> + + <li><a href="../TaskJuggler/ICalendar/Person.html">TaskJuggler::ICalendar::Person</a></li> + + <li><a href="../TaskJuggler/ICalendar/Todo.html">TaskJuggler::ICalendar::Todo</a></li> + <li><a href="../TaskJuggler/Interval.html">TaskJuggler::Interval</a></li> <li><a href="../TaskJuggler/IntervalList.html">TaskJuggler::IntervalList</a></li> - <li><a href="../TaskJuggler/IntervalListAttribute.html">TaskJuggler::IntervalListAttribute</a></li> - <li><a href="../TaskJuggler/JobInfo.html">TaskJuggler::JobInfo</a></li> <li><a href="../TaskJuggler/Journal.html">TaskJuggler::Journal</a></li> <li><a href="../TaskJuggler/JournalEntry.html">TaskJuggler::JournalEntry</a></li> @@ -437,10 +451,12 @@ <li><a href="../TaskJuggler/ReportBase.html">TaskJuggler::ReportBase</a></li> <li><a href="../TaskJuggler/ReportContext.html">TaskJuggler::ReportContext</a></li> + <li><a href="../TaskJuggler/ReportScenario.html">TaskJuggler::ReportScenario</a></li> + <li><a href="../TaskJuggler/ReportServer.html">TaskJuggler::ReportServer</a></li> <li><a href="../TaskJuggler/ReportServerIface.html">TaskJuggler::ReportServerIface</a></li> <li><a href="../TaskJuggler/ReportServerRecord.html">TaskJuggler::ReportServerRecord</a></li> @@ -495,10 +511,12 @@ <li><a href="../TaskJuggler/ScenarioListAttribute.html">TaskJuggler::ScenarioListAttribute</a></li> <li><a href="../TaskJuggler/Scoreboard.html">TaskJuggler::Scoreboard</a></li> + <li><a href="../TaskJuggler/ScoreboardInterval.html">TaskJuggler::ScoreboardInterval</a></li> + <li><a href="../TaskJuggler/SheetHandlerBase.html">TaskJuggler::SheetHandlerBase</a></li> <li><a href="../TaskJuggler/SheetReceiver.html">TaskJuggler::SheetReceiver</a></li> <li><a href="../TaskJuggler/SheetSender.html">TaskJuggler::SheetSender</a></li> @@ -541,10 +559,14 @@ <li><a href="../TaskJuggler/TableOfContents.html">TaskJuggler::TableOfContents</a></li> <li><a href="../TaskJuggler/TableReport.html">TaskJuggler::TableReport</a></li> + <li><a href="../TaskJuggler/TagFile.html">TaskJuggler::TagFile</a></li> + + <li><a href="../TaskJuggler/TagFile/TagFileEntry.html">TaskJuggler::TagFile::TagFileEntry</a></li> + <li><a href="../TaskJuggler/Task.html">TaskJuggler::Task</a></li> <li><a href="../TaskJuggler/TaskDepListAttribute.html">TaskJuggler::TaskDepListAttribute</a></li> <li><a href="../TaskJuggler/TaskDependency.html">TaskJuggler::TaskDependency</a></li> @@ -591,10 +613,14 @@ <li><a href="../TaskJuggler/TextParser/TokenDoc.html">TaskJuggler::TextParser::TokenDoc</a></li> <li><a href="../TaskJuggler/TextReport.html">TaskJuggler::TextReport</a></li> + <li><a href="../TaskJuggler/TimeInterval.html">TaskJuggler::TimeInterval</a></li> + + <li><a href="../TaskJuggler/TimeIntervalListAttribute.html">TaskJuggler::TimeIntervalListAttribute</a></li> + <li><a href="../TaskJuggler/TimeSheet.html">TaskJuggler::TimeSheet</a></li> <li><a href="../TaskJuggler/TimeSheetReceiver.html">TaskJuggler::TimeSheetReceiver</a></li> <li><a href="../TaskJuggler/TimeSheetRecord.html">TaskJuggler::TimeSheetRecord</a></li> @@ -785,37 +811,37 @@ <div class="method-source-code" id="check-ime-one-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 65</span> -65: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) -66: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> -67: -68: <span class="ruby-comment cmt"># Valid time zones must be of the form 'Region/City'</span> -69: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'/'</span>) -70: -71: <span class="ruby-comment cmt"># Save curent value of TZ</span> -72: <span class="ruby-identifier">tz</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] -73: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> -74: <span class="ruby-identifier">newZone</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">zone</span> -75: <span class="ruby-comment cmt"># If the time zone is valid, the OS can convert a zone like</span> -76: <span class="ruby-comment cmt"># 'America/Denver' into 'MST'. Unknown time zones are either not</span> -77: <span class="ruby-comment cmt"># converted or cause a fallback to UTC.</span> -78: <span class="ruby-comment cmt"># Since glibc 2.10 Time.new.zone only return the region for illegal</span> -79: <span class="ruby-comment cmt"># zones instead of the full zone string like it does on earlier</span> -80: <span class="ruby-comment cmt"># versions.</span> -81: <span class="ruby-identifier">region</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">zone</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] -82: <span class="ruby-identifier">res</span> = (<span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">region</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'UTC'</span>) -83: <span class="ruby-comment cmt"># Restore TZ if it was set earlier.</span> -84: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tz</span> -85: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">tz</span> -86: <span class="ruby-keyword kw">else</span> -87: <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'TZ'</span>) -88: <span class="ruby-keyword kw">end</span> -89: <span class="ruby-identifier">res</span> -90: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 64</span> +64: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) +65: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> +66: +67: <span class="ruby-comment cmt"># Valid time zones must be of the form 'Region/City'</span> +68: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'/'</span>) +69: +70: <span class="ruby-comment cmt"># Save curent value of TZ</span> +71: <span class="ruby-identifier">tz</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] +72: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> +73: <span class="ruby-identifier">newZone</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">zone</span> +74: <span class="ruby-comment cmt"># If the time zone is valid, the OS can convert a zone like</span> +75: <span class="ruby-comment cmt"># 'America/Denver' into 'MST'. Unknown time zones are either not</span> +76: <span class="ruby-comment cmt"># converted or cause a fallback to UTC.</span> +77: <span class="ruby-comment cmt"># Since glibc 2.10 Time.new.zone only return the region for illegal</span> +78: <span class="ruby-comment cmt"># zones instead of the full zone string like it does on earlier</span> +79: <span class="ruby-comment cmt"># versions.</span> +80: <span class="ruby-identifier">region</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">zone</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] +81: <span class="ruby-identifier">res</span> = (<span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">region</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'UTC'</span>) +82: <span class="ruby-comment cmt"># Restore TZ if it was set earlier.</span> +83: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tz</span> +84: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">tz</span> +85: <span class="ruby-keyword kw">else</span> +86: <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'TZ'</span>) +87: <span class="ruby-keyword kw">end</span> +88: <span class="ruby-identifier">res</span> +89: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -850,31 +876,31 @@ <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 43</span> -43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">t</span> = <span class="ruby-keyword kw">nil</span>) -44: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-identifier">@@tz</span> -45: -46: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">t</span> -47: <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span> -48: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> -49: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Time</span> -50: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span> -51: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-keyword kw">nil</span> -52: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">TjTime</span> -53: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -54: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-keyword kw">nil</span> -55: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span> -56: <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) -57: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span> -58: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(*<span class="ruby-identifier">t</span>) -59: <span class="ruby-keyword kw">else</span> -60: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">t</span>) -61: <span class="ruby-keyword kw">end</span> -62: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 42</span> +42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">t</span> = <span class="ruby-keyword kw">nil</span>) +43: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-identifier">@@tz</span> +44: +45: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">t</span> +46: <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span> +47: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> +48: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Time</span> +49: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span> +50: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-keyword kw">nil</span> +51: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">TjTime</span> +52: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +53: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-keyword kw">nil</span> +54: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span> +55: <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) +56: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span> +57: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(*<span class="ruby-identifier">t</span>) +58: <span class="ruby-keyword kw">else</span> +59: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">t</span>) +60: <span class="ruby-keyword kw">end</span> +61: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -904,23 +930,23 @@ <div class="method-source-code" id="set-ime-one-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 94</span> - 94: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">setTimeZone</span>(<span class="ruby-identifier">zone</span>) - 95: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) - 96: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Illegal time zone #{zone}&quot;</span> - 97: <span class="ruby-keyword kw">end</span> - 98: - 99: <span class="ruby-identifier">oldTimeZone</span> = <span class="ruby-identifier">@@tz</span> -100: -101: <span class="ruby-identifier">@@tz</span> = <span class="ruby-identifier">zone</span> -102: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> -103: -104: <span class="ruby-identifier">oldTimeZone</span> -105: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 93</span> + 93: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">setTimeZone</span>(<span class="ruby-identifier">zone</span>) + 94: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) + 95: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Illegal time zone #{zone}&quot;</span> + 96: <span class="ruby-keyword kw">end</span> + 97: + 98: <span class="ruby-identifier">oldTimeZone</span> = <span class="ruby-identifier">@@tz</span> + 99: +100: <span class="ruby-identifier">@@tz</span> = <span class="ruby-identifier">zone</span> +101: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> +102: +103: <span class="ruby-identifier">oldTimeZone</span> +104: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -949,14 +975,14 @@ <div class="method-source-code" id="time-one-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 108</span> -108: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">timeZone</span> -109: <span class="ruby-identifier">@@tz</span> -110: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 107</span> +107: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">timeZone</span> +108: <span class="ruby-identifier">@@tz</span> +109: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -992,14 +1018,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 140</span> -140: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">val</span>) -141: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span> -142: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 144</span> +144: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">val</span>) +145: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span> +146: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1028,14 +1054,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 125</span> -125: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">secs</span>) -126: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">secs</span>) -127: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 129</span> +129: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">secs</span>) +130: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">secs</span>) +131: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1065,18 +1091,18 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 131</span> -131: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">arg</span>) -132: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TjTime</span>) -133: <span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">time</span> -134: <span class="ruby-keyword kw">else</span> -135: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>) -136: <span class="ruby-keyword kw">end</span> -137: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 135</span> +135: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">arg</span>) +136: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TjTime</span>) +137: <span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">time</span> +138: <span class="ruby-keyword kw">else</span> +139: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>) +140: <span class="ruby-keyword kw">end</span> +141: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1105,15 +1131,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 145</span> -145: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;</span>(<span class="ruby-identifier">t</span>) -146: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -147: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -148: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 149</span> +149: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;</span>(<span class="ruby-identifier">t</span>) +150: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +151: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +152: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1142,15 +1168,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 151</span> -151: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=</span>(<span class="ruby-identifier">t</span>) -152: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -153: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -154: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 155</span> +155: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=</span>(<span class="ruby-identifier">t</span>) +156: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +157: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +158: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1179,15 +1205,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 175</span> -175: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">t</span>) -176: <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -177: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -178: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 179</span> +179: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">t</span>) +180: <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +181: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +182: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1216,15 +1242,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 169</span> -169: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">t</span>) -170: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -171: <span class="ruby-ivar">@time</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -172: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 173</span> +173: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">t</span>) +174: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +175: <span class="ruby-ivar">@time</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +176: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1253,15 +1279,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 157</span> -157: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">t</span>) -158: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -159: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -160: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 161</span> +161: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">t</span>) +162: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +163: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +164: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1290,15 +1316,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 163</span> -163: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;=</span>(<span class="ruby-identifier">t</span>) -164: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> -165: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -166: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 167</span> +167: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;=</span>(<span class="ruby-identifier">t</span>) +168: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">t</span> +169: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +170: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1328,14 +1354,14 @@ <div class="method-source-code" id="align-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 113</span> -113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">clock</span>) -114: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>((<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">clock</span>) * <span class="ruby-identifier">clock</span>) -115: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 112</span> +112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">clock</span>) +113: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>((<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">clock</span>) * <span class="ruby-identifier">clock</span>) +114: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1364,16 +1390,16 @@ <div class="method-source-code" id="begin-f-our-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 191</span> -191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfHour</span> -192: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -193: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-value">0</span> -194: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -195: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 195</span> +195: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfHour</span> +196: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +197: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-value">0</span> +198: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +199: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1402,17 +1428,17 @@ <div class="method-source-code" id="begin-f-onth-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 220</span> -220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfMonth</span> -221: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -222: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> -223: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> -224: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -225: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 224</span> +224: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfMonth</span> +225: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +226: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> +227: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> +228: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +229: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1441,18 +1467,18 @@ <div class="method-source-code" id="begin-f-uarter-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 228</span> -228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfQuarter</span> -229: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -230: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> -231: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> -232: <span class="ruby-identifier">month</span> = ((<span class="ruby-identifier">month</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">%</span> <span class="ruby-value">3</span> ) <span class="ruby-operator">+</span> <span class="ruby-value">1</span> -233: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -234: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 232</span> +232: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfQuarter</span> +233: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +234: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> +235: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> +236: <span class="ruby-identifier">month</span> = ((<span class="ruby-identifier">month</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">%</span> <span class="ruby-value">3</span> ) <span class="ruby-operator">+</span> <span class="ruby-value">1</span> +237: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +238: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1482,23 +1508,23 @@ <div class="method-source-code" id="begin-f-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 206</span> -206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfWeek</span>(<span class="ruby-identifier">startMonday</span>) -207: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -208: <span class="ruby-comment cmt"># Set time to noon, 12:00:00</span> -209: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = [ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">12</span> ] -210: <span class="ruby-identifier">weekday</span> = <span class="ruby-identifier">t</span>[<span class="ruby-value">6</span>] -211: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -212: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -213: <span class="ruby-comment cmt"># Substract the number of days determined by the weekday t[6] and set time</span> -214: <span class="ruby-comment cmt"># to midnight of that day.</span> -215: (<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) <span class="ruby-operator">-</span> -216: (<span class="ruby-identifier">weekday</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">startMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>).<span class="ruby-identifier">midnight</span> -217: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 210</span> +210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfWeek</span>(<span class="ruby-identifier">startMonday</span>) +211: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +212: <span class="ruby-comment cmt"># Set time to noon, 12:00:00</span> +213: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = [ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">12</span> ] +214: <span class="ruby-identifier">weekday</span> = <span class="ruby-identifier">t</span>[<span class="ruby-value">6</span>] +215: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +216: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +217: <span class="ruby-comment cmt"># Substract the number of days determined by the weekday t[6] and set time</span> +218: <span class="ruby-comment cmt"># to midnight of that day.</span> +219: (<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) <span class="ruby-operator">-</span> +220: (<span class="ruby-identifier">weekday</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">startMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>).<span class="ruby-identifier">midnight</span> +221: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1527,17 +1553,17 @@ <div class="method-source-code" id="begin-f-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 237</span> -237: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfYear</span> -238: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -239: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> -240: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> -241: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -242: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 241</span> +241: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfYear</span> +242: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +243: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> +244: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> +245: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +246: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1566,14 +1592,14 @@ <div class="method-source-code" id="day-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 399</span> -399: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">day</span> -400: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">day</span> -401: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 403</span> +403: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">day</span> +404: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">day</span> +405: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1603,14 +1629,14 @@ <div class="method-source-code" id="days-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 336</span> -336: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">daysTo</span>(<span class="ruby-identifier">date</span>) -337: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextDay</span>) -338: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 340</span> +340: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">daysTo</span>(<span class="ruby-identifier">date</span>) +341: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextDay</span>) +342: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1639,14 +1665,14 @@ <div class="method-source-code" id="hour-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 394</span> -394: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hour</span> -395: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">hour</span> -396: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 398</span> +398: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hour</span> +399: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">hour</span> +400: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1675,14 +1701,14 @@ <div class="method-source-code" id="hours-ater-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 245</span> -245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursLater</span>(<span class="ruby-identifier">hours</span>) -246: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hours</span> * <span class="ruby-value">3600</span>) -247: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 249</span> +249: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursLater</span>(<span class="ruby-identifier">hours</span>) +250: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hours</span> * <span class="ruby-value">3600</span>) +251: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1712,15 +1738,15 @@ <div class="method-source-code" id="hours-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 329</span> -329: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursTo</span>(<span class="ruby-identifier">date</span>) -330: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -331: ((<span class="ruby-identifier">t2</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t1</span>) <span class="ruby-operator">/</span> <span class="ruby-value">3600</span>).<span class="ruby-identifier">ceil</span> -332: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 333</span> +333: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursTo</span>(<span class="ruby-identifier">date</span>) +334: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +335: ((<span class="ruby-identifier">t2</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t1</span>) <span class="ruby-operator">/</span> <span class="ruby-value">3600</span>).<span class="ruby-identifier">ceil</span> +336: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1749,16 +1775,16 @@ <div class="method-source-code" id="midnight-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 198</span> -198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">midnight</span> -199: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -200: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> -201: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -202: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 202</span> +202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">midnight</span> +203: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +204: <span class="ruby-identifier">sec</span> = <span class="ruby-identifier">min</span> = <span class="ruby-identifier">hour</span> = <span class="ruby-value">0</span> +205: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +206: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1816,14 +1842,14 @@ <div class="method-source-code" id="month-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 404</span> -404: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">month</span> -405: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">month</span> -406: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 408</span> +408: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">month</span> +409: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">month</span> +410: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1857,14 +1883,14 @@ <div class="method-source-code" id="month-nd-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 432</span> -432: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthAndYear</span> -433: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b %Y'</span>) -434: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 436</span> +436: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthAndYear</span> +437: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b %Y'</span>) +438: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1894,14 +1920,14 @@ <div class="method-source-code" id="months-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 348</span> -348: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthsTo</span>(<span class="ruby-identifier">date</span>) -349: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextMonth</span>) -350: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 352</span> +352: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthsTo</span>(<span class="ruby-identifier">date</span>) +353: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextMonth</span>) +354: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1934,18 +1960,18 @@ <div class="method-source-code" id="next-ay-f-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 319</span> -319: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextDayOfWeek</span>(<span class="ruby-identifier">dow</span>) -320: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Day of week must be 0 - 6.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">6</span> -321: <span class="ruby-identifier">d</span> = <span class="ruby-identifier">midnight</span>.<span class="ruby-identifier">sameTimeNextDay</span> -322: <span class="ruby-identifier">currentDoW</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%w'</span>).<span class="ruby-identifier">to_i</span> -323: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>((<span class="ruby-identifier">dow</span> <span class="ruby-operator">+</span> <span class="ruby-value">7</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">currentDoW</span>) <span class="ruby-operator">%</span> <span class="ruby-value">7</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">sameTimeNextDay</span> } -324: <span class="ruby-identifier">d</span> -325: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 323</span> +323: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextDayOfWeek</span>(<span class="ruby-identifier">dow</span>) +324: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Day of week must be 0 - 6.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">6</span> +325: <span class="ruby-identifier">d</span> = <span class="ruby-identifier">midnight</span>.<span class="ruby-identifier">sameTimeNextDay</span> +326: <span class="ruby-identifier">currentDoW</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%w'</span>).<span class="ruby-identifier">to_i</span> +327: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>((<span class="ruby-identifier">dow</span> <span class="ruby-operator">+</span> <span class="ruby-value">7</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">currentDoW</span>) <span class="ruby-operator">%</span> <span class="ruby-value">7</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">sameTimeNextDay</span> } +328: <span class="ruby-identifier">d</span> +329: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1974,14 +2000,14 @@ <div class="method-source-code" id="quarter-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 421</span> -421: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quarterName</span> -422: <span class="ruby-node">&quot;Q#{(localtime.mon / 3) + 1}&quot;</span> -423: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 425</span> +425: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quarterName</span> +426: <span class="ruby-node">&quot;Q#{(localtime.mon / 3) + 1}&quot;</span> +427: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2011,14 +2037,14 @@ <div class="method-source-code" id="quarters-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 354</span> -354: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quartersTo</span>(<span class="ruby-identifier">date</span>) -355: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextQuarter</span>) -356: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 358</span> +358: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quartersTo</span>(<span class="ruby-identifier">date</span>) +359: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextQuarter</span>) +360: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2048,22 +2074,22 @@ <div class="method-source-code" id="same-ime-ext-ay-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 256</span> -256: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextDay</span> -257: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -258: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">day</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) -259: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> -260: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -261: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> -262: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -263: <span class="ruby-keyword kw">end</span> -264: <span class="ruby-keyword kw">end</span> -265: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -266: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 260</span> +260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextDay</span> +261: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +262: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">day</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) +263: <span class="ruby-identifier">day</span> = <span class="ruby-value">1</span> +264: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +265: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> +266: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +267: <span class="ruby-keyword kw">end</span> +268: <span class="ruby-keyword kw">end</span> +269: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +270: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2092,14 +2118,14 @@ <div class="method-source-code" id="same-ime-ext-our-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 250</span> -250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextHour</span> -251: <span class="ruby-identifier">hoursLater</span>(<span class="ruby-value">1</span>) -252: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 254</span> +254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextHour</span> +255: <span class="ruby-identifier">hoursLater</span>(<span class="ruby-value">1</span>) +256: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2129,21 +2155,21 @@ <div class="method-source-code" id="same-ime-ext-onth-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 284</span> -284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextMonth</span> -285: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -286: <span class="ruby-identifier">monMax</span> = <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] -287: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -288: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> -289: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -290: <span class="ruby-keyword kw">end</span> -291: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">monMax</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) -292: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -293: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 288</span> +288: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextMonth</span> +289: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +290: <span class="ruby-identifier">monMax</span> = <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] +291: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +292: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> +293: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +294: <span class="ruby-keyword kw">end</span> +295: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">monMax</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) +296: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +297: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2173,19 +2199,19 @@ <div class="method-source-code" id="same-ime-ext-uarter-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 297</span> -297: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextQuarter</span> -298: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -299: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">3</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -300: <span class="ruby-identifier">month</span> <span class="ruby-operator">-=</span> <span class="ruby-value">12</span> -301: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -302: <span class="ruby-keyword kw">end</span> -303: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -304: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 301</span> +301: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextQuarter</span> +302: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +303: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">3</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +304: <span class="ruby-identifier">month</span> <span class="ruby-operator">-=</span> <span class="ruby-value">12</span> +305: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +306: <span class="ruby-keyword kw">end</span> +307: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +308: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2215,22 +2241,22 @@ <div class="method-source-code" id="same-ime-ext-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 270</span> -270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextWeek</span> -271: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -272: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">day</span> <span class="ruby-operator">+=</span> <span class="ruby-value">7</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) -273: <span class="ruby-identifier">day</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) -274: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -275: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> -276: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -277: <span class="ruby-keyword kw">end</span> -278: <span class="ruby-keyword kw">end</span> -279: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) -280: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 274</span> +274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextWeek</span> +275: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +276: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">day</span> <span class="ruby-operator">+=</span> <span class="ruby-value">7</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) +277: <span class="ruby-identifier">day</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) +278: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +279: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> +280: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +281: <span class="ruby-keyword kw">end</span> +282: <span class="ruby-keyword kw">end</span> +283: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span> ]) +284: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2260,16 +2286,16 @@ <div class="method-source-code" id="same-ime-ext-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 308</span> -308: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextYear</span> -309: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -310: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -311: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span>]) -312: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 312</span> +312: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextYear</span> +313: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +314: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +315: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span>]) +316: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2299,15 +2325,15 @@ <div class="method-source-code" id="seconds-f-ay-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 119</span> -119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">secondsOfDay</span>(<span class="ruby-identifier">tz</span> = <span class="ruby-keyword kw">nil</span>) -120: <span class="ruby-identifier">lt</span> = <span class="ruby-identifier">localtime</span> -121: (<span class="ruby-identifier">lt</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">lt</span>.<span class="ruby-identifier">gmt_offset</span>) <span class="ruby-operator">%</span> (<span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>) -122: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 123</span> +123: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">secondsOfDay</span>(<span class="ruby-identifier">tz</span> = <span class="ruby-keyword kw">nil</span>) +124: <span class="ruby-identifier">lt</span> = <span class="ruby-identifier">localtime</span> +125: (<span class="ruby-identifier">lt</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">lt</span>.<span class="ruby-identifier">gmt_offset</span>) <span class="ruby-operator">%</span> (<span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>) +126: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2336,14 +2362,14 @@ <div class="method-source-code" id="short-onth-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 416</span> -416: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shortMonthName</span> -417: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b'</span>) -418: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 420</span> +420: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shortMonthName</span> +421: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b'</span>) +422: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2370,14 +2396,14 @@ <div class="method-source-code" id="strftime-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 384</span> -384: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) -385: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) -386: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 388</span> +388: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) +389: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) +390: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2404,14 +2430,14 @@ <div class="method-source-code" id="to-a-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 380</span> -380: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span> -381: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -382: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 384</span> +384: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span> +385: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +386: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2440,14 +2466,14 @@ <div class="method-source-code" id="to-i-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 376</span> -376: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span> -377: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_i</span> -378: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 380</span> +380: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span> +381: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_i</span> +382: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2477,19 +2503,19 @@ <div class="method-source-code" id="to-s-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 366</span> -366: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-keyword kw">nil</span>) -367: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'unknown'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">nil?</span> -368: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span>.<span class="ruby-identifier">nil?</span> -369: <span class="ruby-identifier">format</span> = <span class="ruby-value str">'%Y-%m-%d-%H:%M'</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-value str">':%S'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'-%z'</span> -370: <span class="ruby-keyword kw">end</span> -371: <span class="ruby-comment cmt"># Always report values in local timezone</span> -372: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) -373: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 370</span> +370: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-keyword kw">nil</span>) +371: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'unknown'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">nil?</span> +372: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span>.<span class="ruby-identifier">nil?</span> +373: <span class="ruby-identifier">format</span> = <span class="ruby-value str">'%Y-%m-%d-%H:%M'</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-value str">':%S'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'-%z'</span> +374: <span class="ruby-keyword kw">end</span> +375: <span class="ruby-comment cmt"># Always report values in local timezone</span> +376: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) +377: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2519,28 +2545,64 @@ <div class="method-source-code" id="upto-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 182</span> -182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upto</span>(<span class="ruby-identifier">endDate</span>, <span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>) -183: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> -184: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">endDate</span>.<span class="ruby-identifier">time</span> -185: <span class="ruby-keyword kw">yield</span>(<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>)) -186: <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">step</span> -187: <span class="ruby-keyword kw">end</span> -188: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 186</span> +186: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upto</span>(<span class="ruby-identifier">endDate</span>, <span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>) +187: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> +188: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">endDate</span>.<span class="ruby-identifier">time</span> +189: <span class="ruby-keyword kw">yield</span>(<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>)) +190: <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">step</span> +191: <span class="ruby-keyword kw">end</span> +192: <span class="ruby-keyword kw">end</span></pre> </div> </div> </div> + <div id="utc-method" class="method-detail "> + <a name="method-i-utc"></a> + + <div class="method-heading"> + + <span class="method-name">utc</span><span + class="method-args">()</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + <p> +Return the time object in UTC. +</p> + + + + <div class="method-source-code" + id="utc-source"> +<pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 117</span> +117: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">utc</span> +118: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">gmtime</span>) +119: <span class="ruby-keyword kw">end</span></pre> + </div> + + </div> + + + + + </div> + + <div id="wday-method" class="method-detail "> <a name="method-i-wday"></a> <div class="method-heading"> @@ -2559,14 +2621,14 @@ <div class="method-source-code" id="wday-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 389</span> -389: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wday</span> -390: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">wday</span> -391: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 393</span> +393: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wday</span> +394: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">wday</span> +395: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2596,14 +2658,14 @@ <div class="method-source-code" id="week-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 427</span> -427: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">week</span>(<span class="ruby-identifier">weekStartsMonday</span>) -428: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">weekStartsMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'%W'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'%U'</span>) -429: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 431</span> +431: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">week</span>(<span class="ruby-identifier">weekStartsMonday</span>) +432: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">weekStartsMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'%W'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'%U'</span>) +433: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2633,14 +2695,14 @@ <div class="method-source-code" id="weekday-nd-ate-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 437</span> -437: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weekdayAndDate</span> -438: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%A %Y-%m-%d'</span>) -439: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 441</span> +441: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weekdayAndDate</span> +442: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%A %Y-%m-%d'</span>) +443: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2670,14 +2732,14 @@ <div class="method-source-code" id="weeks-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 342</span> -342: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weeksTo</span>(<span class="ruby-identifier">date</span>) -343: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextWeek</span>) -344: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 346</span> +346: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weeksTo</span>(<span class="ruby-identifier">date</span>) +347: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextWeek</span>) +348: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2706,14 +2768,14 @@ <div class="method-source-code" id="year-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 411</span> -411: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">year</span> -412: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">year</span> -413: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 415</span> +415: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">year</span> +416: <span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">year</span> +417: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2743,14 +2805,14 @@ <div class="method-source-code" id="years-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 360</span> -360: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yearsTo</span>(<span class="ruby-identifier">date</span>) -361: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextYear</span>) -362: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 364</span> +364: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yearsTo</span>(<span class="ruby-identifier">date</span>) +365: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextYear</span>) +366: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2783,20 +2845,20 @@ <div class="method-source-code" id="count-ntervals-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 547</span> -547: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">stepFunc</span>) -548: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span> -549: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -550: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t2</span> -551: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stepFunc</span>) -552: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -553: <span class="ruby-keyword kw">end</span> -554: <span class="ruby-identifier">i</span> -555: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 551</span> +551: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">stepFunc</span>) +552: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span> +553: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +554: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t2</span> +555: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stepFunc</span>) +556: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +557: <span class="ruby-keyword kw">end</span> +558: <span class="ruby-identifier">i</span> +559: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2823,14 +2885,14 @@ <div class="method-source-code" id="last-ay-f-onth-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 557</span> -557: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) -558: <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] -559: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 561</span> +561: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lastDayOfMonth</span>(<span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span>) +562: <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] +563: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2857,21 +2919,21 @@ <div class="method-source-code" id="leap-ear--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 561</span> -561: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) -562: <span class="ruby-keyword kw">case</span> -563: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">400</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -564: <span class="ruby-keyword kw">true</span> -565: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -566: <span class="ruby-keyword kw">false</span> -567: <span class="ruby-keyword kw">else</span> -568: <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -569: <span class="ruby-keyword kw">end</span> -570: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 565</span> +565: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) +566: <span class="ruby-keyword kw">case</span> +567: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">400</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +568: <span class="ruby-keyword kw">true</span> +569: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +570: <span class="ruby-keyword kw">false</span> +571: <span class="ruby-keyword kw">else</span> +572: <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +573: <span class="ruby-keyword kw">end</span> +574: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2898,30 +2960,30 @@ <div class="method-source-code" id="localtime-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 572</span> -572: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">localtime</span> -573: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@timeZone</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">@@tz</span> -574: -575: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">utc?</span> -576: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">@@tz</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> -577: <span class="ruby-comment cmt"># @time is already in the right zone (UTC)</span> -578: <span class="ruby-ivar">@time</span> -579: <span class="ruby-keyword kw">else</span> -580: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">localtime</span> -581: <span class="ruby-keyword kw">end</span> -582: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">@@tz</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> -583: <span class="ruby-comment cmt"># @time is not in UTC, so convert it to local time.</span> -584: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">gmtime</span> -585: <span class="ruby-keyword kw">else</span> -586: <span class="ruby-comment cmt"># To convert a Time object from one local time to another, we need to</span> -587: <span class="ruby-comment cmt"># conver to UTC first and then to the new local time.</span> -588: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">gmtime</span>.<span class="ruby-identifier">localtime</span> -589: <span class="ruby-keyword kw">end</span> -590: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 576</span> +576: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">localtime</span> +577: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@time</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@timeZone</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">@@tz</span> +578: +579: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">utc?</span> +580: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">@@tz</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> +581: <span class="ruby-comment cmt"># @time is already in the right zone (UTC)</span> +582: <span class="ruby-ivar">@time</span> +583: <span class="ruby-keyword kw">else</span> +584: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">localtime</span> +585: <span class="ruby-keyword kw">end</span> +586: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">@@tz</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> +587: <span class="ruby-comment cmt"># @time is not in UTC, so convert it to local time.</span> +588: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">gmtime</span> +589: <span class="ruby-keyword kw">else</span> +590: <span class="ruby-comment cmt"># To convert a Time object from one local time to another, we need to</span> +591: <span class="ruby-comment cmt"># conver to UTC first and then to the new local time.</span> +592: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">gmtime</span>.<span class="ruby-identifier">localtime</span> +593: <span class="ruby-keyword kw">end</span> +594: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2948,14 +3010,14 @@ <div class="method-source-code" id="order-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 543</span> -543: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -544: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">date</span> <span class="ruby-operator">?</span> [ <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">date</span> ] <span class="ruby-operator">:</span> [ <span class="ruby-identifier">date</span>, <span class="ruby-keyword kw">self</span> ] -545: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 547</span> +547: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +548: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">date</span> <span class="ruby-operator">?</span> [ <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">date</span> ] <span class="ruby-operator">:</span> [ <span class="ruby-identifier">date</span>, <span class="ruby-keyword kw">self</span> ] +549: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2982,109 +3044,109 @@ <div class="method-source-code" id="parse-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 443</span> -443: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) -444: <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">time</span>, <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'-'</span>, <span class="ruby-value">5</span>) -445: -446: <span class="ruby-comment cmt"># Check the year</span> -447: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> -448: <span class="ruby-identifier">year</span> = <span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_i</span> -449: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1970</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2035</span> -450: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Year #{year} out of range (1970 - 2035)&quot;</span> -451: <span class="ruby-keyword kw">end</span> -452: <span class="ruby-keyword kw">else</span> -453: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Year not specified&quot;</span> -454: <span class="ruby-keyword kw">end</span> -455: -456: <span class="ruby-comment cmt"># Check the month</span> -457: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> -458: <span class="ruby-identifier">month</span> = <span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_i</span> -459: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -460: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Month #{month} out of range (1 - 12)&quot;</span> -461: <span class="ruby-keyword kw">end</span> -462: <span class="ruby-keyword kw">else</span> -463: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Month not specified&quot;</span> -464: <span class="ruby-keyword kw">end</span> -465: -466: <span class="ruby-comment cmt"># Check the day</span> -467: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> -468: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_i</span> -469: <span class="ruby-identifier">maxDay</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">31</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">gregorian_leap?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-value">28</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, -470: <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span> ] -471: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">maxDay</span>[<span class="ruby-identifier">month</span>] -472: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Day #{day} out of range (1 - #{maxDay[month]})&quot;</span> -473: <span class="ruby-keyword kw">end</span> -474: <span class="ruby-keyword kw">else</span> -475: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Day not specified&quot;</span> -476: <span class="ruby-keyword kw">end</span> -477: -478: <span class="ruby-comment cmt"># The time is optional. Will be expanded to 00:00:00.</span> -479: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time</span> -480: <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>) + <span class="ruby-comment cmt"># File lib/taskjuggler/TjTime.rb, line 447</span> +447: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) +448: <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">time</span>, <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'-'</span>, <span class="ruby-value">5</span>) +449: +450: <span class="ruby-comment cmt"># Check the year</span> +451: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> +452: <span class="ruby-identifier">year</span> = <span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_i</span> +453: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1970</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2035</span> +454: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Year #{year} out of range (1970 - 2035)&quot;</span> +455: <span class="ruby-keyword kw">end</span> +456: <span class="ruby-keyword kw">else</span> +457: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Year not specified&quot;</span> +458: <span class="ruby-keyword kw">end</span> +459: +460: <span class="ruby-comment cmt"># Check the month</span> +461: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> +462: <span class="ruby-identifier">month</span> = <span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_i</span> +463: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +464: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Month #{month} out of range (1 - 12)&quot;</span> +465: <span class="ruby-keyword kw">end</span> +466: <span class="ruby-keyword kw">else</span> +467: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Month not specified&quot;</span> +468: <span class="ruby-keyword kw">end</span> +469: +470: <span class="ruby-comment cmt"># Check the day</span> +471: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> +472: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_i</span> +473: <span class="ruby-identifier">maxDay</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">31</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">gregorian_leap?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-value">28</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, +474: <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span> ] +475: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">maxDay</span>[<span class="ruby-identifier">month</span>] +476: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Day #{day} out of range (1 - #{maxDay[month]})&quot;</span> +477: <span class="ruby-keyword kw">end</span> +478: <span class="ruby-keyword kw">else</span> +479: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Day not specified&quot;</span> +480: <span class="ruby-keyword kw">end</span> 481: -482: <span class="ruby-comment cmt"># Check hour</span> -483: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> -484: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">hour</span>.<span class="ruby-identifier">to_i</span> -485: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span> -486: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Hour #{hour} out of range (0 - 23)&quot;</span> -487: <span class="ruby-keyword kw">end</span> -488: <span class="ruby-keyword kw">else</span> -489: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Hour not specified&quot;</span> -490: <span class="ruby-keyword kw">end</span> -491: -492: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> -493: <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">minute</span>.<span class="ruby-identifier">to_i</span> -494: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -495: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Minute #{minute} out of range (0 - 59)&quot;</span> -496: <span class="ruby-keyword kw">end</span> -497: <span class="ruby-keyword kw">else</span> -498: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Minute not specified&quot;</span> -499: <span class="ruby-keyword kw">end</span> -500: -501: <span class="ruby-comment cmt"># Check sencond. This value is optional and defaults to 0.</span> -502: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> -503: <span class="ruby-identifier">second</span> = <span class="ruby-identifier">second</span>.<span class="ruby-identifier">to_i</span> -504: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -505: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Second #{second} out of range (0 - 59)&quot;</span> -506: <span class="ruby-keyword kw">end</span> -507: <span class="ruby-keyword kw">else</span> -508: <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> -509: <span class="ruby-keyword kw">end</span> -510: <span class="ruby-keyword kw">else</span> -511: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> -512: <span class="ruby-keyword kw">end</span> -513: -514: <span class="ruby-comment cmt"># The zone is optional and defaults to the current time zone.</span> -515: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> -516: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">--</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">++</span> -517: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must be prefixed by &quot;</span> <span class="ruby-operator">+</span> -518: <span class="ruby-node">&quot;+ or -, not #{zone[0]}&quot;</span> -519: <span class="ruby-keyword kw">end</span> -520: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">5</span> -521: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must use (+/-)HHMM format&quot;</span> -522: <span class="ruby-keyword kw">end</span> -523: -524: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) -525: <span class="ruby-identifier">sign</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">--</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span> -526: <span class="ruby-identifier">tzHour</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span> -527: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -528: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment hour out of range &quot;</span> <span class="ruby-operator">+</span> -529: <span class="ruby-node">&quot;(0 - 12) but is #{tzHour}&quot;</span> -530: <span class="ruby-keyword kw">end</span> -531: <span class="ruby-identifier">tzMinute</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">4</span>].<span class="ruby-identifier">to_i</span> -532: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -533: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment minute out of range &quot;</span> <span class="ruby-operator">+</span> -534: <span class="ruby-node">&quot;(0 - 59) but is #{tzMinute}&quot;</span> -535: <span class="ruby-keyword kw">end</span> -536: <span class="ruby-ivar">@time</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sign</span> * (<span class="ruby-identifier">tzHour</span> * <span class="ruby-value">3600</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tzMinute</span> * <span class="ruby-value">60</span>) -537: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-value str">'UTC'</span> -538: <span class="ruby-keyword kw">else</span> -539: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) -540: <span class="ruby-keyword kw">end</span> -541: <span class="ruby-keyword kw">end</span></pre> +482: <span class="ruby-comment cmt"># The time is optional. Will be expanded to 00:00:00.</span> +483: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time</span> +484: <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>) +485: +486: <span class="ruby-comment cmt"># Check hour</span> +487: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> +488: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">hour</span>.<span class="ruby-identifier">to_i</span> +489: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span> +490: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Hour #{hour} out of range (0 - 23)&quot;</span> +491: <span class="ruby-keyword kw">end</span> +492: <span class="ruby-keyword kw">else</span> +493: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Hour not specified&quot;</span> +494: <span class="ruby-keyword kw">end</span> +495: +496: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> +497: <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">minute</span>.<span class="ruby-identifier">to_i</span> +498: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +499: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Minute #{minute} out of range (0 - 59)&quot;</span> +500: <span class="ruby-keyword kw">end</span> +501: <span class="ruby-keyword kw">else</span> +502: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Minute not specified&quot;</span> +503: <span class="ruby-keyword kw">end</span> +504: +505: <span class="ruby-comment cmt"># Check sencond. This value is optional and defaults to 0.</span> +506: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> +507: <span class="ruby-identifier">second</span> = <span class="ruby-identifier">second</span>.<span class="ruby-identifier">to_i</span> +508: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +509: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Second #{second} out of range (0 - 59)&quot;</span> +510: <span class="ruby-keyword kw">end</span> +511: <span class="ruby-keyword kw">else</span> +512: <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> +513: <span class="ruby-keyword kw">end</span> +514: <span class="ruby-keyword kw">else</span> +515: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> +516: <span class="ruby-keyword kw">end</span> +517: +518: <span class="ruby-comment cmt"># The zone is optional and defaults to the current time zone.</span> +519: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> +520: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">--</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">++</span> +521: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must be prefixed by &quot;</span> <span class="ruby-operator">+</span> +522: <span class="ruby-node">&quot;+ or -, not #{zone[0]}&quot;</span> +523: <span class="ruby-keyword kw">end</span> +524: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">5</span> +525: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must use (+/-)HHMM format&quot;</span> +526: <span class="ruby-keyword kw">end</span> +527: +528: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) +529: <span class="ruby-identifier">sign</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">--</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span> +530: <span class="ruby-identifier">tzHour</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span> +531: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +532: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment hour out of range &quot;</span> <span class="ruby-operator">+</span> +533: <span class="ruby-node">&quot;(0 - 12) but is #{tzHour}&quot;</span> +534: <span class="ruby-keyword kw">end</span> +535: <span class="ruby-identifier">tzMinute</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">4</span>].<span class="ruby-identifier">to_i</span> +536: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +537: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment minute out of range &quot;</span> <span class="ruby-operator">+</span> +538: <span class="ruby-node">&quot;(0 - 59) but is #{tzMinute}&quot;</span> +539: <span class="ruby-keyword kw">end</span> +540: <span class="ruby-ivar">@time</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sign</span> * (<span class="ruby-identifier">tzHour</span> * <span class="ruby-value">3600</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tzMinute</span> * <span class="ruby-value">60</span>) +541: <span class="ruby-ivar">@timeZone</span> = <span class="ruby-value str">'UTC'</span> +542: <span class="ruby-keyword kw">else</span> +543: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) +544: <span class="ruby-keyword kw">end</span> +545: <span class="ruby-keyword kw">end</span></pre> </div> </div>