<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:конвертация строка->время и операции?]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8439&amp;type=atom" />
	<updated>2013-07-04T09:54:33Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8439</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73461#p73461" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Но по большому счету, главное чтобы работало.</p></blockquote></div><p>По большому счету, надо вникать в &quot;алгоритм <span class="bbu">более</span>* правильных решений&quot;. Тем паче, что:<br /></p><div class="quotebox"><cite>ТС пишет:</cite><blockquote><p>Можно ли как-то немудрено</p></blockquote></div><p>А не :</p><div class="quotebox"><blockquote><p>Приведите все способы решения задачи</p></blockquote></div><p><strong>Malcev</strong><br />Ваш алгоритм можно расписать на 1 строку кода, с помощью выражения. И это очевидно. Я &quot;раскатал&quot; на 4 строки. Чтобы была универсальность, и можно было (при желании) также получать дату в нужном формате.</p><p>---------------------------------</p><p>*Указатель, на относительность утверждения. Т.к. наверняка можно сделать ещё проще.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-07-04T09:54:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73461#p73461</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73452#p73452" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>А есть смысл городить огород, когда есть встроенные методы обработки времени?</p></blockquote></div><p>Нету. Я решал задачу ориентировочно своих знаний.<br />Конечно ваш способ короче.<br />Но по большому счету, главное чтобы работало.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-07-03T23:50:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73452#p73452</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73431#p73431" />
			<content type="html"><![CDATA[<p>Можно ещё сократить решение:<br /></p><div class="codebox"><pre><code>
StartTime = 21:02:09
Duration = 04:58:01

StringSplit, D, Duration, :
Time := 20010101 RegExReplace(StartTime, &quot;:&quot;), S:=(D1*3600)+(D2*60)+D3
Time += S, S
FormatTime, EndTime, % Time, HH:mm:ss

MsgBox % EndTime
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-07-03T09:00:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73431#p73431</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73430#p73430" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>А вот и мой исправленный:</p></blockquote></div><p>А есть смысл городить огород, когда есть встроенные методы обработки времени?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-07-03T08:37:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73430#p73430</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73423#p73423" />
			<content type="html"><![CDATA[<p>Ваш вариант неправильно форматирует время.<br />Правильней:<br /></p><div class="codebox"><pre><code>FormatTime, Time, % Time, HH:mm:ss</code></pre></div><p>А вот и мой исправленный:<br /></p><div class="codebox"><pre><code>StartTime = 21:02:59
Duration = 48:58:01

StringSplit, Start, StartTime, :
StringSplit, Dur, Duration, :
if (Start3 + Dur3) &gt;= 60
{
   Start3 -=60
   Start2 +=1
}
if (Start2 + Dur2) &gt;= 60
{
   Start2 -=60
   Start1 += 1
}
while (Start1 + Dur1) &gt;= 24
   Start1 -=24
EndTime3 := Start3 + Dur3
EndTime2 := Start2 + Dur2
EndTime1 := Start1 + Dur1
SetFormat, float, 02.0
Loop, 3
   EndTime%A_Index% += 0.0
msgbox, EndTime = %EndTime1%:%EndTime2%:%EndTime3%
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-07-02T13:52:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73423#p73423</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73419#p73419" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Можно так:</p></blockquote></div><div class="codebox"><pre><code>StartTime = 21:02:59
Duration = 04:58:01</code></pre></div><p>А на таких значениях?</p><br /><br /><div class="codebox"><pre><code>
StartTime = 21:02:59
Duration = 04:58:01

Time := A_YYYY A_MM A_DD RegExReplace(StartTime, &quot;:&quot;)
StringSplit, Dur, Duration, :
Time += Dur3, S
Time += Dur2, M
Time += Dur1, H
FormatTime, EndTime, % Time, HH:mm:ss

MsgBox % EndTime
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-07-02T10:24:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73419#p73419</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73415#p73415" />
			<content type="html"><![CDATA[<p>Можно так:<br /></p><div class="codebox"><pre><code>StartTime = 01:02:59
Duration = 04:58:01

StringSplit, Start, StartTime, :
StringSplit, Dur, Duration, :
if (Start3 + Dur3) &gt;= 60
{
   Start3 -= 60
   Start2 += 1
}
if (Start2 + Dur2) &gt;= 60
{
   Start2 -= 60
   Start1 += 1
}
EndTime3 := Start3 + Dur3
EndTime2 := Start2 + Dur2
EndTime1 := Start1 + Dur1
SetFormat, float, 02.0
Loop, 3
   EndTime%A_Index% += 0.0
msgbox, EndTime = %EndTime1%:%EndTime2%:%EndTime3%
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-07-01T21:56:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73415#p73415</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK:конвертация строка->время и операции?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=73413#p73413" />
			<content type="html"><![CDATA[<p>Доброе утро,</p><p>Есть метки времени - начала неких событий, и есть длительности этих событий.<br />Все вида HH:mm:ss, в формате строки.<br />Можно ли как-то немудрено сложить начала и длительности, дабы получить финалы событий, в том же виде?</p>]]></content>
			<author>
				<name><![CDATA[Zeirram]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30355</uri>
			</author>
			<updated>2013-07-01T21:19:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=73413#p73413</id>
		</entry>
</feed>
