Bug 1881773 - Collect timezone. r=tjr

Differential Revision: https://phabricator.services.mozilla.com/D202598
This commit is contained in:
Tom Ritter 2024-03-08 21:29:04 +00:00
parent 2a054b5578
commit 54b9f6b7db
2 changed files with 29 additions and 0 deletions

View File

@ -318,3 +318,21 @@ characteristics:
expires: never
data_sensitivity:
- technical
timezone:
type: string
description: >
The the current timezone of the system
lifetime: application
send_in_pings:
- user-characteristics
notification_emails:
- tom@mozilla.com
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1879151
- https://bugzilla.mozilla.org/show_bug.cgi?id=1881773
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1881773#c4
expires: never
data_sensitivity:
- interaction

View File

@ -18,6 +18,7 @@
#include "mozilla/RelativeLuminanceUtils.h"
#include "mozilla/ServoStyleConsts.h"
#include "mozilla/dom/ScreenBinding.h"
#include "mozilla/intl/TimeZone.h"
#include "mozilla/widget/ScreenManager.h"
#include "gfxPlatformFontList.h"
@ -252,6 +253,16 @@ nsresult nsUserCharacteristics::PopulateData(bool aTesting /* = false */) {
}
mozilla::glean::characteristics::processor_count.Set(processorCount);
AutoTArray<char16_t, 128> tzBuffer;
auto result = mozilla::intl::TimeZone::GetDefaultTimeZone(tzBuffer);
if (result.isOk()) {
NS_ConvertUTF16toUTF8 timeZone(
nsDependentString(tzBuffer.Elements(), tzBuffer.Length()));
mozilla::glean::characteristics::timezone.Set(timeZone);
} else {
mozilla::glean::characteristics::timezone.Set("<error>"_ns);
}
return NS_OK;
}