hrev54217 adds 1 changeset to branch 'master'
old head: 79ca65ac9d561fe4c83f88a015350e9f591d8b2c
new head: 05d6891800b50ebc7fe95bbe93d8233322b5d718
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=05d6891800b5+%5E79ca65ac9d56
----------------------------------------------------------------------------
05d6891800b5: HaikuDepot: do not use ICU directly.
Change-Id: I0097fe51cc9b41509e5ba0d2452c5f28eac0538a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2724
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54217
Commit: 05d6891800b50ebc7fe95bbe93d8233322b5d718
URL: https://git.haiku-os.org/haiku/commit/?id=05d6891800b5
Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date: Sun May 17 14:51:38 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun May 17 16:00:53 2020 UTC
----------------------------------------------------------------------------
1 file changed, 6 insertions(+), 27 deletions(-)
src/apps/haikudepot/util/LocaleUtils.cpp | 33 +++++-----------------------
----------------------------------------------------------------------------
diff --git a/src/apps/haikudepot/util/LocaleUtils.cpp
b/src/apps/haikudepot/util/LocaleUtils.cpp
index 46eb7bced4..4014b3fcb9 100644
--- a/src/apps/haikudepot/util/LocaleUtils.cpp
+++ b/src/apps/haikudepot/util/LocaleUtils.cpp
@@ -5,13 +5,10 @@
#include "LocaleUtils.h"
#include <stdlib.h>
-#include <unicode/datefmt.h>
-#include <unicode/dtptngen.h>
-#include <unicode/smpdtfmt.h>
#include <Catalog.h>
#include <Collator.h>
-#include <ICUWrapper.h>
+#include <DateTimeFormat.h>
#include <Locale.h>
#include <LocaleRoster.h>
#include <StringFormat.h>
@@ -48,37 +45,19 @@ LocaleUtils::GetCollator(BCollator* collator)
}
-/*! There was some difficulty in getting BDateTime and friends to
- work for the purposes of this application. Data comes in as millis since
- the epoc relative to GMT0. These need to be displayed in the local time
- zone, but the timezone aspect never seems to be quite right with BDateTime!
- For now, to avoid this work over-spilling into a debug of the date-time
- classes in Haiku, I am adding this method that uses ICU directly in order
- to get something basic working for now. Later this should be migrated to
- use the BDateTime etc... classes from Haiku once these problems have been
- ironed out.
-*/
-
/*static*/ BString
LocaleUtils::TimestampToDateTimeString(uint64 millis)
{
if (millis == 0)
return "?";
- UnicodeString pattern("yyyy-MM-dd HH:mm:ss");
- // later use variants of DateFormat::createInstance()
- UErrorCode success = U_ZERO_ERROR;
- SimpleDateFormat sdf(pattern, success);
-
- if (U_FAILURE(success))
+ BDateTimeFormat format;
+ BString buffer;
+ if (format.Format(buffer, millis / 1000, B_SHORT_DATE_FORMAT,
+ B_SHORT_TIME_FORMAT) != B_OK)
return "!";
- UnicodeString icuResult;
- sdf.format((UDate) millis, icuResult);
- BString result;
- BStringByteSink converter(&result);
- icuResult.toUTF8(converter);
- return result;
+ return buffer;
}