| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) | 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) |
| 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * The Original Code is Mozilla Communicator client code, released | 5 * The Original Code is Mozilla Communicator client code, released |
| 6 * March 31, 1998. | 6 * March 31, 1998. |
| 7 * | 7 * |
| 8 * The Initial Developer of the Original Code is | 8 * The Initial Developer of the Original Code is |
| 9 * Netscape Communications Corporation. | 9 * Netscape Communications Corporation. |
| 10 * Portions created by the Initial Developer are Copyright (C) 1998 | 10 * Portions created by the Initial Developer are Copyright (C) 1998 |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 return buffer; | 912 return buffer; |
| 913 } | 913 } |
| 914 | 914 |
| 915 UString formatTime(const GregorianDateTime &t, bool utc) | 915 UString formatTime(const GregorianDateTime &t, bool utc) |
| 916 { | 916 { |
| 917 char buffer[100]; | 917 char buffer[100]; |
| 918 if (utc) { | 918 if (utc) { |
| 919 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.hour, t.minute,
t.second); | 919 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.hour, t.minute,
t.second); |
| 920 } else { | 920 } else { |
| 921 int offset = abs(gmtoffset(t)); | 921 int offset = abs(gmtoffset(t)); |
| 922 char tzname[70]; | 922 char timeZoneName[70]; |
| 923 struct tm gtm = t; | 923 struct tm gtm = t; |
| 924 strftime(tzname, sizeof(tzname), "%Z", >m); | 924 strftime(timeZoneName, sizeof(timeZoneName), "%Z", >m); |
| 925 | 925 |
| 926 if (tzname[0]) { | 926 if (timeZoneName[0]) { |
| 927 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)"
, | 927 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d (%s)"
, |
| 928 t.hour, t.minute, t.second, | 928 t.hour, t.minute, t.second, |
| 929 gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) %
60, tzname); | 929 gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) %
60, timeZoneName); |
| 930 } else { | 930 } else { |
| 931 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d", | 931 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d", |
| 932 t.hour, t.minute, t.second, | 932 t.hour, t.minute, t.second, |
| 933 gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) %
60); | 933 gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) %
60); |
| 934 } | 934 } |
| 935 } | 935 } |
| 936 return UString(buffer); | 936 return UString(buffer); |
| 937 } | 937 } |
| 938 | 938 |
| 939 } // namespace JSC | 939 } // namespace JSC |
| 940 | 940 |
| OLD | NEW |