diff --git a/toolkit/components/resistfingerprinting/metrics.yaml b/toolkit/components/resistfingerprinting/metrics.yaml index 6ac093efab65..4b50b284b1a0 100644 --- a/toolkit/components/resistfingerprinting/metrics.yaml +++ b/toolkit/components/resistfingerprinting/metrics.yaml @@ -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 diff --git a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp index ba6861aa8093..f0bc1d8786d2 100644 --- a/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp +++ b/toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp @@ -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 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(""_ns); + } + return NS_OK; }