-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor time util and improve diagnostic logging with timezone friendly date and time for Brave Ads events #5444
Conversation
2de515f
to
023d050
Compare
@@ -5,7 +5,7 @@ | |||
|
|||
#include "bat/ads/internal/frequency_capping/exclusion_rules/per_hour_frequency_cap.h" | |||
#include "bat/ads/internal/frequency_capping/frequency_capping.h" | |||
#include "bat/ads/internal/time.h" | |||
#include "bat/ads/internal/time_util.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't seem to be using anything defined in time_util.h
, is that right? Are we including it just to get base/time/time.h
? I see a bunch of similar includes of time_util.h
.
@@ -31,7 +32,8 @@ std::string Reports::GenerateAdNotificationEventReport( | |||
rapidjson::StringBuffer buffer; | |||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); | |||
|
|||
const std::string timestamp = Time::Timestamp(); | |||
const base::Time time = base::Time::Now(); | |||
const std::string timestamp = FriendlyDateAndTime(time, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this isn't really a "timestamp" anymore, but rather a formatted date string, but it looks like renaming the variable/JSON field would be painful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logs are being refactored as part of brave/brave-browser#6845 and brave/brave-browser#9533 so reports will be deprecated
@@ -1040,8 +1040,13 @@ uint64_t ConfirmationsImpl::GetAdNotificationsReceivedThisMonthForTransactions( | |||
now.UTCExplode(&now_exploded); | |||
|
|||
for (const auto& transaction : transactions) { | |||
if (transaction.timestamp_in_seconds == 0) { | |||
// Workaround for Windows crash when passing 0 to UTCExplode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -0,0 +1,76 @@ | |||
/* Copyright (c) 2020 The Brave Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame that we have to duplicate, but 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree, and I have raised brave/brave-browser#9611
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
CI failed for iOS, macOS and Windows. Restarting |
CI failed for macOS and Windows. Restarting |
CI failed macOS, restarting macOS |
macOS failed on CI, restarting macOS |
9fac124
to
dc34c5b
Compare
…dly date and time for Brave Ads events
Failed CI due to known iOS issue and rewards browser tests |
Resolves brave/brave-browser#9199
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist:
After-merge Checklist:
changes has landed on.