Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 525849c

Browse files
Merge remote-tracking branch 'origin/develop-6.7' into merge-6.7.8_100915
Refactoring: * function remove_seconds, added in sysunxdate.cpp, had to be updated to use StringRef ide submodule has been update appropriately to the HEAD of develop-7.0 Conflicts: engine/src/sysunxdate.cpp ide
2 parents 6ec72da + ddd6a66 commit 525849c

File tree

5 files changed

+43
-3
lines changed

5 files changed

+43
-3
lines changed

configure.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ SET warnings=0
99
REM Not all versions of windows the the %programfiles(x86)% variable
1010
IF NOT DEFINED programfiles(x86) SET programfiles(x86)=%programfiles%
1111

12+
REM When calling configure.bat from the command line, BUILD_EDITION is not defined
13+
IF NOT DEFINED BUILD_EDITION SET BUILD_EDITION="community"
14+
1215
REM Note: to test whether a directory exists in batch script, you need to check
1316
REM whether a file within that directory exists. Easiest way to do this is to
1417
REM add the "*" wildcard after the directory

docs/dictionary/function/time.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@
4545
<example>set the label of button "Clock" to the short system time</example>
4646
</examples>
4747
<description>
48-
<p>Use the <b>time</b> <control_st tag="function">function</control_st> to display the current time to the user, or to store the time for later use.</p><p/><p><b>Value:</b></p><p>If the <b>useSystemDate</b> <glossary tag="property">property</glossary> is set to true or if you specify the <keyword tag="system">system</keyword> time, the times returned by the <b>time</b> <control_st tag="function">function</control_st> are <glossary tag="format">formatted</glossary> according to the user's system preferences.</p><p/><p>If the <b>useSystemDate</b> is false or if you specify the <keyword tag="english">english</keyword> time, the times are in the <function tag="format">format</function> described below:</p><p/><p>The<code> time </code>form returns the hour and minute separated by a colon, a space, and "<code>AM</code>" or "<code>PM</code>".</p><p/><p>The<code> short time </code>form returns the same value as the<code> time </code>form.</p><p/><p>The<code> abbreviated time </code>form returns the same value as the<code> time </code>form.</p><p/><p>The<code> long time </code>form returns the hour, minute, and second separated by colons, a space, and "<code>AM</code>" or "<code>PM</code>".</p><p/><p><b>Comments:</b></p><p>If the <b>twelveHourTime</b> <glossary tag="property">property</glossary> is set to false, the value <glossary tag="return">returned</glossary> by the <b>time</b> <control_st tag="function">function</control_st> does not include "<code>AM</code>" or "<code>PM</code>".</p><p/><p>The format of the<code> system time </code>forms is set by the Date &amp; Time control panel (on Mac OS systems), the Date control panel (on <glossary tag="Windows">Windows systems</glossary>), or the LANG environment variable (on <glossary tag="Unix">Unix systems</glossary>).</p><p/><p><b>Changes:</b></p><p>The ability to use the time format preferred by the user was introduced in version 1.1. In previous versions, the <b>time</b> <control_st tag="function">function</control_st>, along with the <function tag="date">date</function> <control_st tag="function">function</control_st>, consistently used the standard U.S. <function tag="format">format</function>, even if the operating system's settings specified another language or time <function tag="format">format</function>.</p>
48+
<p>Use the <b>time</b> <control_st tag="function">function</control_st> to display the current time to the user, or to store the time for later use.</p><p/><p><b>Value:</b></p><p>If the <b>useSystemDate</b> <glossary tag="property">property</glossary> is set to true or if you specify the <keyword tag="system">system</keyword> time, the times returned by the <b>time</b> <control_st tag="function">function</control_st> are <glossary tag="format">formatted</glossary> according to the user's system preferences.</p><p/><p>If the <b>useSystemDate</b> is false or if you specify the <keyword tag="english">english</keyword> time, the times are in the <function tag="format">format</function> described below:</p><p/><p>The<code> time </code>form returns the hour and minute separated by a colon, a space, and "<code>AM</code>" or "<code>PM</code>".</p><p/><p>The<code> short time </code>form returns the same value as the<code> time </code>form.</p><p/><p>The<code> abbreviated time </code>form returns the same value as the<code> time </code>form.</p><p/><p>The<code> long time </code>form returns the hour, minute, and second separated by colons, a space, and "<code>AM</code>" or "<code>PM</code>".</p><p/><p><b>Comments:</b></p><p>If the <b>twelveHourTime</b> <glossary tag="property">property</glossary> is set to false, the value <glossary tag="return">returned</glossary> by the <b>time</b> <control_st tag="function">function</control_st> does not include "<code>AM</code>" or "<code>PM</code>".</p><p/><p>The format of the<code> system time </code>forms is set by the Date &amp; Time control panel (on Mac OS systems), the Date control panel (on <glossary tag="Windows">Windows systems</glossary>), or the LANG environment variable (on <glossary tag="Unix">Unix systems</glossary>). Linux systems don't have a short system time, so the engine modifies the system time format string to remove the seconds. This works in most locales, but not all and our advice is to stick to using the long system time on Linux systems.</p><p/><p><b>Changes:</b></p><p>The ability to use the time format preferred by the user was introduced in version 1.1. In previous versions, the <b>time</b> <control_st tag="function">function</control_st>, along with the <function tag="date">date</function> <control_st tag="function">function</control_st>, consistently used the standard U.S. <function tag="format">format</function>, even if the operating system's settings specified another language or time <function tag="format">format</function>.</p>
4949
</description>
5050
</doc>

docs/notes/bugfix-9942.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# The "system time" is always retured in long format on Linux

engine/src/sysunxdate.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,34 @@ static MCStringRef string_prepend(MCStringRef t_string, unichar_t t_char)
171171
return t_result;
172172
}
173173

174+
175+
// PM-2015-09-07: [[ Bug 9942 ]] On Linux, the short/abbr system time should
176+
// not return the seconds
177+
static MCStringRef remove_seconds(MCStringRef p_input)
178+
{
179+
MCStringRef t_new_string;
180+
MCRange t_range;
181+
182+
if (MCStringFind(p_input, MCRangeMake(0, UINDEX_MAX), MCSTR(":%S"), kMCStringOptionCompareExact, &t_range))
183+
{
184+
// If :%S is found, then we remove it
185+
MCAutoStringRef t_mutable_copy;
186+
/* UNCHECKED */ MCStringMutableCopy(p_input, &t_mutable_copy);
187+
188+
/* UNCHECKED */ MCStringRemove(*t_mutable_copy, t_range);
189+
190+
/* UNCHECKED */ MCStringCopy(*t_mutable_copy, t_new_string);
191+
}
192+
else
193+
{
194+
// Otherwise we take the whole string
195+
t_new_string = MCValueRetain(p_input);
196+
}
197+
198+
return t_new_string;
199+
}
200+
201+
174202
static MCStringRef query_locale(uint4 t_index)
175203
{
176204
char *t_buffer;
@@ -230,8 +258,16 @@ static void cache_locale(void)
230258
}
231259
else
232260
{
233-
s_datetime_locale -> time_formats[0] = string_prepend(swap_time_tokens(t_time_ampm), '!');
261+
// PM-2015-09-07: [[ Bug 9942 ]] On Linux, the short/abbr system time
262+
// should not return the seconds
263+
MCStringRef t_short_time;
264+
t_short_time = string_prepend(swap_time_tokens(t_time_ampm), '!');
265+
266+
s_datetime_locale -> time_formats[0] = remove_seconds(t_short_time);
234267
s_datetime_locale -> time_formats[1] = swap_time_tokens(t_time_ampm);
268+
269+
// string_prepend() returns a new StringRef, which we must release
270+
MCValueRelease(t_short_time);
235271
}
236272

237273
s_datetime_locale -> time24_formats[0] = MCSTR("!%H:%M");

ide

Submodule ide updated from 73dc4b1 to eccd43e

0 commit comments

Comments
 (0)