Add timezone offset to new document creation date [pdfium : main]

0 views
Skip to first unread message

Kuka (Gerrit)

unread,
Jun 22, 2026, 10:31:56 AM (3 days ago) Jun 22
to pdfium-...@googlegroups.com

Kuka has uploaded the change for review

Commit message

Add timezone offset to new document creation date

FPDF_CreateNewDocument() writes CreationDate using the local time, but omitted the UTC offset. Include the offset in the PDF date string when machine time is available.

Add a deterministic regression test for a non-hour timezone offset and update the saved document expectation for the longer date string.
Bug: 525699558
Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef

Change diff

diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 6e66cf7..8787bf2 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -4,6 +4,7 @@

#include <stdint.h>

+#include <time.h>
#include <array>
#include <limits>
#include <memory>
@@ -32,7 +33,9 @@
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_annot.h"
+#include "public/fpdf_doc.h"
#include "public/fpdf_edit.h"
+#include "public/fpdf_ext.h"
#include "public/fpdfview.h"
#include "testing/embedder_test.h"
#include "testing/embedder_test_constants.h"
@@ -71,6 +74,24 @@

constexpr char kNotoSansScPng[] = "noto_sans_sc";

+time_t FakeTime() {
+ return 1587611121; // 2020-04-23 03:05:21 UTC.
+}
+
+tm* FakeLocaltime(const time_t* time) {
+ static tm fake_local_time = {};
+ if (*time != FakeTime()) {
+ return nullptr;
+ }
+ fake_local_time.tm_year = 2020 - 1900;
+ fake_local_time.tm_mon = 4 - 1;
+ fake_local_time.tm_mday = 23;
+ fake_local_time.tm_hour = 10;
+ fake_local_time.tm_min = 35;
+ fake_local_time.tm_sec = 21;
+ return &fake_local_time;
+}
+
struct FPDFEditMoveEmbedderTestCase {
std::vector<int> page_indices;
int page_indices_len;
@@ -269,14 +290,14 @@
"0000000017 00000 n\r\n"
"0000000066 00000 n\r\n"
"0000000122 00000 n\r\n"
- "0000000192 00000 n\r\n"
+ "0000000199 00000 n\r\n"
"trailer\r\n"
"<<\r\n"
"/Root 1 0 R\r\n"
"/Info 3 0 R\r\n"
"/Size 5/ID\\[<.*><.*>\\]>>\r\n"
"startxref\r\n"
- "285\r\n"
+ "292\r\n"
"%%EOF\r\n";

} // namespace
@@ -379,6 +400,19 @@
kExpectedPDF, sizeof(kExpectedPDF))));
}

+TEST_F(FPDFEditEmbedderTest, NewDocumentCreationDateHasTimeZone) {
+ FSDK_SetTimeFunction(FakeTime);
+ FSDK_SetLocaltimeFunction(FakeLocaltime);
+ ScopedFPDFDocument doc(FPDF_CreateNewDocument());
+ FSDK_SetTimeFunction(nullptr);
+ FSDK_SetLocaltimeFunction(nullptr);
+ ASSERT_TRUE(doc);
+
+ unsigned short buf[128];
+ ASSERT_EQ(48u, FPDF_GetMetaText(doc.get(), "CreationDate", buf, sizeof(buf)));
+ EXPECT_EQ(L"D:20200423103521+07'30'", GetPlatformWString(buf));
+}
+
// Regression test for https://crbug.com/667012
TEST_F(FPDFEditEmbedderTest, RasterizePDF) {
const char kAllBlackPng[] = "black_612x792";
diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp
index 7b5613e..c1b7905 100644
--- a/fpdfsdk/fpdf_editpage.cpp
+++ b/fpdfsdk/fpdf_editpage.cpp
@@ -51,6 +51,10 @@

namespace {

+constexpr int kMinutesPerHour = 60;
+constexpr int kHoursPerDay = 24;
+constexpr int kMinutesPerDay = kMinutesPerHour * kHoursPerDay;
+
static_assert(FPDF_PAGEOBJ_TEXT ==
static_cast<int>(CPDF_PageObject::Type::kText),
"FPDF_PAGEOBJ_TEXT/CPDF_PageObject::TEXT mismatch");
@@ -171,6 +175,51 @@
return {params, page_obj};
}

+int64_t DaysSinceEpoch(const tm& time) {
+ int year = time.tm_year + 1900;
+ const int month = time.tm_mon + 1;
+ const int day = time.tm_mday;
+ year -= month <= 2 ? 1 : 0;
+ const int era = (year >= 0 ? year : year - 399) / 400;
+ const unsigned year_of_era = static_cast<unsigned>(year - era * 400);
+ const unsigned month_of_year =
+ static_cast<unsigned>(month > 2 ? month - 3 : month + 9);
+ const unsigned day_of_year =
+ (153 * month_of_year + 2) / 5 + static_cast<unsigned>(day) - 1;
+ const unsigned day_of_era =
+ year_of_era * 365 + year_of_era / 4 - year_of_era / 100 + day_of_year;
+ return era * 146097 + static_cast<int>(day_of_era) - 719468;
+}
+
+int TimeZoneOffsetInMinutes(const tm& local_time, const tm& utc_time) {
+ const int64_t day_offset =
+ DaysSinceEpoch(local_time) - DaysSinceEpoch(utc_time);
+ return static_cast<int>(day_offset * kMinutesPerDay +
+ (local_time.tm_hour - utc_time.tm_hour) *
+ kMinutesPerHour +
+ local_time.tm_min - utc_time.tm_min);
+}
+
+ByteString FormatPDFDate(time_t current_time, tm local_time) {
+ tm* utc_time = gmtime(&current_time);
+ if (!utc_time) {
+ return ByteString::Format("D:%04d%02d%02d%02d%02d%02d",
+ local_time.tm_year + 1900, local_time.tm_mon + 1,
+ local_time.tm_mday, local_time.tm_hour,
+ local_time.tm_min, local_time.tm_sec);
+ }
+
+ const int offset_minutes = TimeZoneOffsetInMinutes(local_time, *utc_time);
+ const int abs_offset_minutes =
+ offset_minutes < 0 ? -offset_minutes : offset_minutes;
+ return ByteString::Format(
+ "D:%04d%02d%02d%02d%02d%02d%c%02d'%02d'", local_time.tm_year + 1900,
+ local_time.tm_mon + 1, local_time.tm_mday, local_time.tm_hour,
+ local_time.tm_min, local_time.tm_sec, offset_minutes < 0 ? '-' : '+',
+ abs_offset_minutes / kMinutesPerHour,
+ abs_offset_minutes % kMinutesPerHour);
+}
+
} // namespace

FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() {
@@ -185,9 +234,7 @@
if (FXSYS_time(&currentTime) != -1) {
tm* pTM = FXSYS_localtime(&currentTime);
if (pTM) {
- DateStr = ByteString::Format(
- "D:%04d%02d%02d%02d%02d%02d", pTM->tm_year + 1900, pTM->tm_mon + 1,
- pTM->tm_mday, pTM->tm_hour, pTM->tm_min, pTM->tm_sec);
+ DateStr = FormatPDFDate(currentTime, *pTM);
}
}
}

Change information

Files:
  • M fpdfsdk/fpdf_edit_embeddertest.cpp
  • M fpdfsdk/fpdf_editpage.cpp
Change size: M
Delta: 2 files changed, 86 insertions(+), 5 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
Gerrit-Change-Number: 150390
Gerrit-PatchSet: 1
Gerrit-Owner: Kuka <tyck...@gmail.com>
unsatisfied_requirement
open
diffy

Tom Sepez (Gerrit)

unread,
Jun 22, 2026, 12:40:23 PM (3 days ago) Jun 22
to Kuka, Lei Zhang, pdfium-...@googlegroups.com
Attention needed from Kuka and Lei Zhang

Tom Sepez added 7 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Tom Sepez . resolved

Thanks for taking this on. Mostly questions about how to re-organize your work for modularization.

File fpdfsdk/fpdf_edit_embeddertest.cpp
Line 6, Patchset 2 (Latest):
Tom Sepez . unresolved

nit: blank line after this header but not before to group c/c++ includes into sections.

Line 77, Patchset 2 (Latest):time_t FakeTime() {
Tom Sepez . unresolved

I'm pretty sure we've got a mechanism to set fake local time for other tests ... see fake_time_test.cpp. Maybe this can be moved there or otherwise re-used.

Line 293, Patchset 2 (Latest): "0000000199 00000 n\r\n"
Tom Sepez . unresolved

I didn't see where 7 extra bytes were introduced prior to these size recalculations.

Line 407, Patchset 2 (Latest): FSDK_SetTimeFunction(nullptr);
Tom Sepez . unresolved

Use fxcrt::AutoRestorer here if possible.

File fpdfsdk/fpdf_editpage.cpp
Line 178, Patchset 2 (Latest):int64_t DaysSinceEpoch(const tm& time) {
Tom Sepez . unresolved

Because `local_time` and `utc_time` represent the exact same moment in time, their difference is bounded by the maximum timezone offsets (which range from -12 to +14 hours). This means the two timestamps will only ever be at most 1 day apart.

We don't need a full epoch conversion to find the difference in days. We can just compare `tm_mday`. If the difference is `> 1` or `< -1`, we know it wrapped around a month or year boundary and can safely map it to `-1` or `1`.

You can drop `DaysSinceEpoch()` entirely and simplify the calculation to:

```cpp

int TimeZoneOffsetInMinutes(const tm& local_time, const tm& utc_time) {
  int day_offset = local_time.tm_mday - utc_time.tm_mday;
if (day_offset > 1) {
day_offset = -1;
} else if (day_offset < -1) {
day_offset = 1;
}
  return day_offset * kMinutesPerDay +
(local_time.tm_hour - utc_time.tm_hour) * kMinutesPerHour +
(local_time.tm_min - utc_time.tm_min);
}
```
Line 194, Patchset 2 (Latest):int TimeZoneOffsetInMinutes(const tm& local_time, const tm& utc_time) {
Tom Sepez . unresolved

Maybe this should go into fx_extension.{h,cpp} as FXSYS_TimeZoneOffsetMinutes() instead of here.

Open in Gerrit

Related details

Attention is currently required from:
  • Kuka
  • Lei Zhang
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: pdfium
    Gerrit-Branch: main
    Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
    Gerrit-Change-Number: 150390
    Gerrit-PatchSet: 2
    Gerrit-Owner: Kuka <tyck...@gmail.com>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
    Gerrit-Attention: Lei Zhang <the...@chromium.org>
    Gerrit-Attention: Kuka <tyck...@gmail.com>
    Gerrit-Comment-Date: Mon, 22 Jun 2026 16:40:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Kuka (Gerrit)

    unread,
    Jun 23, 2026, 11:05:16 AM (2 days ago) Jun 23
    to Lei Zhang, Tom Sepez, pdfium-...@googlegroups.com
    Attention needed from Lei Zhang and Tom Sepez

    Kuka added 6 comments

    File fpdfsdk/fpdf_edit_embeddertest.cpp
    Line 6, Patchset 2:
    Tom Sepez . resolved

    nit: blank line after this header but not before to group c/c++ includes into sections.

    Kuka

    Done

    Line 77, Patchset 2:time_t FakeTime() {
    Tom Sepez . resolved

    I'm pretty sure we've got a mechanism to set fake local time for other tests ... see fake_time_test.cpp. Maybe this can be moved there or otherwise re-used.

    Kuka

    Done. Reused pdfium::FakeTimeScope from testing/fake_time_test.h and removed the local FakeTime/FakeLocaltime helpers from this test.

    Line 293, Patchset 2: "0000000199 00000 n\r\n"
    Tom Sepez . resolved

    I didn't see where 7 extra bytes were introduced prior to these size recalculations.

    Kuka

    Done

    Line 407, Patchset 2: FSDK_SetTimeFunction(nullptr);
    Tom Sepez . resolved

    Use fxcrt::AutoRestorer here if possible.

    Kuka

    Done. Added scoped time-function helpers that use fxcrt::AutoRestorer internally, and updated the test to use them so the hooks are restored automatically.

    File fpdfsdk/fpdf_editpage.cpp
    Line 178, Patchset 2:int64_t DaysSinceEpoch(const tm& time) {
    Tom Sepez . resolved

    Because `local_time` and `utc_time` represent the exact same moment in time, their difference is bounded by the maximum timezone offsets (which range from -12 to +14 hours). This means the two timestamps will only ever be at most 1 day apart.

    We don't need a full epoch conversion to find the difference in days. We can just compare `tm_mday`. If the difference is `> 1` or `< -1`, we know it wrapped around a month or year boundary and can safely map it to `-1` or `1`.

    You can drop `DaysSinceEpoch()` entirely and simplify the calculation to:

    ```cpp
    int TimeZoneOffsetInMinutes(const tm& local_time, const tm& utc_time) {
    int day_offset = local_time.tm_mday - utc_time.tm_mday;
    if (day_offset > 1) {
    day_offset = -1;
    } else if (day_offset < -1) {
    day_offset = 1;
    }
      return day_offset * kMinutesPerDay +
    (local_time.tm_hour - utc_time.tm_hour) * kMinutesPerHour +
    (local_time.tm_min - utc_time.tm_min);
    }
    ```
    Kuka

    Done. Removed `DaysSinceEpoch()` and simplified the calculation to use the bounded `tm_mday` difference with month/year wrap handling.

    Line 194, Patchset 2:int TimeZoneOffsetInMinutes(const tm& local_time, const tm& utc_time) {
    Tom Sepez . resolved

    Maybe this should go into fx_extension.{h,cpp} as FXSYS_TimeZoneOffsetMinutes() instead of here.

    Kuka

    Done. Moved the calculation to `FXSYS_TimeZoneOffsetInMinutes()` in `fx_extension.{h,cpp}` and added focused unit coverage there.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Lei Zhang
    • Tom Sepez
    Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
      Gerrit-Change-Number: 150390
      Gerrit-PatchSet: 3
      Gerrit-Owner: Kuka <tyck...@gmail.com>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      Gerrit-Attention: Lei Zhang <the...@chromium.org>
      Gerrit-Attention: Tom Sepez <tse...@chromium.org>
      Gerrit-Comment-Date: Tue, 23 Jun 2026 15:05:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Tom Sepez <tse...@chromium.org>
      unsatisfied_requirement
      open
      diffy

      Tom Sepez (Gerrit)

      unread,
      Jun 23, 2026, 11:47:14 AM (2 days ago) Jun 23
      to Kuka, Lei Zhang, pdfium-...@googlegroups.com
      Attention needed from Kuka and Lei Zhang

      Tom Sepez voted and added 3 comments

      Votes added by Tom Sepez

      Code-Review+1

      3 comments

      Commit Message
      Line 13, Patchset 4:Add a deterministic regression test for a non-hour timezone offset and
      Tom Sepez . resolved

      The folks on Lord Howe Island will appreciate this :) .

      File core/fxcrt/fx_extension.h
      Line 187, Patchset 4:
      Tom Sepez . unresolved

      If you were so inclined, `using fxcrt::ScopedLocalTimeFunction;` since the namespace here is to avoid linker conflicts, but this would be the only such name in pdfium. Same for the other one.

      File core/fxcrt/fx_extension_unittest.cpp
      Line 156, Patchset 4: tm local_time = {};
      tm utc_time = {};

      local_time.tm_mday = 23;
      local_time.tm_hour = 10;
      local_time.tm_min = 35;
      Tom Sepez . unresolved
      you can likely write these using designated initializers, e.g.
      ```
      const tm local_time = {
      .tm_mday = 23,
      .tm_hour = 10,
      .tm_min = 35.
      };

      Then surround each test case with
      {
      }
      to re-declare and avoid assignments.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Kuka
      • Lei Zhang
      Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: pdfium
        Gerrit-Branch: main
        Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
        Gerrit-Change-Number: 150390
        Gerrit-PatchSet: 4
        Gerrit-Owner: Kuka <tyck...@gmail.com>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
        Gerrit-Attention: Lei Zhang <the...@chromium.org>
        Gerrit-Attention: Kuka <tyck...@gmail.com>
        Gerrit-Comment-Date: Tue, 23 Jun 2026 15:47:08 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        open
        diffy

        Kuka (Gerrit)

        unread,
        Jun 23, 2026, 11:47:30 AM (2 days ago) Jun 23
        to Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
        Attention needed from Kuka and Lei Zhang

        Kuka added 1 comment

        Patchset-level comments
        File-level comment, Patchset 5 (Latest):
        Kuka . resolved

        Done. Could you PTAL when you have a chance? Thank you!

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Kuka
        • Lei Zhang
        Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: pdfium
        Gerrit-Branch: main
        Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
        Gerrit-Change-Number: 150390
        Gerrit-PatchSet: 5
        Gerrit-Owner: Kuka <tyck...@gmail.com>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
        Gerrit-Attention: Lei Zhang <the...@chromium.org>
        Gerrit-Attention: Kuka <tyck...@gmail.com>
        Gerrit-Comment-Date: Tue, 23 Jun 2026 15:47:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        unsatisfied_requirement
        open
        diffy

        Kuka (Gerrit)

        unread,
        Jun 23, 2026, 12:01:26 PM (2 days ago) Jun 23
        to Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
        Attention needed from Lei Zhang and Tom Sepez

        Kuka added 3 comments

        Patchset-level comments
        File-level comment, Patchset 5:
        Kuka . unresolved

        Done. Addressed both comments in the latest patch set. Could you PTAL when you have a chance? Thank you!

        File core/fxcrt/fx_extension.h
        Line 187, Patchset 4:
        Tom Sepez . resolved

        If you were so inclined, `using fxcrt::ScopedLocalTimeFunction;` since the namespace here is to avoid linker conflicts, but this would be the only such name in pdfium. Same for the other one.

        Kuka

        Done

        File core/fxcrt/fx_extension_unittest.cpp
        Line 156, Patchset 4: tm local_time = {};
        tm utc_time = {};

        local_time.tm_mday = 23;
        local_time.tm_hour = 10;
        local_time.tm_min = 35;
        Tom Sepez . resolved
        you can likely write these using designated initializers, e.g.
        ```
        const tm local_time = {
        .tm_mday = 23,
        .tm_hour = 10,
        .tm_min = 35.
        };

        Then surround each test case with
        {
        }
        to re-declare and avoid assignments.

        Kuka

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Lei Zhang
        • Tom Sepez
        Submit Requirements:
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: pdfium
        Gerrit-Branch: main
        Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
        Gerrit-Change-Number: 150390
        Gerrit-PatchSet: 5
        Gerrit-Owner: Kuka <tyck...@gmail.com>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
        Gerrit-Attention: Lei Zhang <the...@chromium.org>
        Gerrit-Attention: Tom Sepez <tse...@chromium.org>
        Gerrit-Comment-Date: Tue, 23 Jun 2026 16:01:17 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Tom Sepez <tse...@chromium.org>
        unsatisfied_requirement
        open
        diffy

        Tom Sepez (Gerrit)

        unread,
        Jun 23, 2026, 12:04:01 PM (2 days ago) Jun 23
        to Kuka, Lei Zhang, pdfium-...@googlegroups.com
        Attention needed from Kuka and Lei Zhang

        Tom Sepez voted and added 1 comment

        Votes added by Tom Sepez

        Code-Review+1

        1 comment

        Patchset-level comments

        Done. Addressed both comments in the latest patch set. Could you PTAL when you have a chance? Thank you!

        Tom Sepez

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Kuka
        • Lei Zhang
        Submit Requirements:
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: pdfium
        Gerrit-Branch: main
        Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
        Gerrit-Change-Number: 150390
        Gerrit-PatchSet: 6
        Gerrit-Owner: Kuka <tyck...@gmail.com>
        Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
        Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
        Gerrit-Attention: Lei Zhang <the...@chromium.org>
        Gerrit-Attention: Kuka <tyck...@gmail.com>
        Gerrit-Comment-Date: Tue, 23 Jun 2026 16:03:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Kuka <tyck...@gmail.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Lei Zhang (Gerrit)

        unread,
        Jun 23, 2026, 2:16:34 PM (2 days ago) Jun 23
        to Kuka, pdfium...@luci-project-accounts.iam.gserviceaccount.com, Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
        Attention needed from Kuka

        Lei Zhang added 2 comments

        File core/fxcrt/fx_extension.h
        Line 164, Patchset 6 (Latest):class ScopedTimeFunction {
        Lei Zhang . unresolved

        Since these scoper classes are only used in tests, can they move into testing/utils/ instead?

        File fpdfsdk/fpdf_edit_embeddertest.cpp
        Line 6, Patchset 2:
        Tom Sepez . unresolved

        nit: blank line after this header but not before to group c/c++ includes into sections.

        Kuka

        Done

        Lei Zhang

        Still need to swap the 2 lines so the C headers are grouped together.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Kuka
        Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: pdfium
          Gerrit-Branch: main
          Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
          Gerrit-Change-Number: 150390
          Gerrit-PatchSet: 6
          Gerrit-Owner: Kuka <tyck...@gmail.com>
          Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
          Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
          Gerrit-Attention: Kuka <tyck...@gmail.com>
          Gerrit-Comment-Date: Tue, 23 Jun 2026 18:16:28 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Tom Sepez <tse...@chromium.org>
          Comment-In-Reply-To: Kuka <tyck...@gmail.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Lei Zhang (Gerrit)

          unread,
          Jun 23, 2026, 2:21:04 PM (2 days ago) Jun 23
          to Kuka, pdfium...@luci-project-accounts.iam.gserviceaccount.com, Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
          Attention needed from Kuka

          Lei Zhang added 3 comments

          File fpdfsdk/fpdf_editpage.cpp
          Line 174, Patchset 6 (Latest):ByteString FormatPDFDate(time_t current_time, tm local_time) {
          Lei Zhang . unresolved

          Take a const-ref?

          Line 187, Patchset 6 (Latest): offset_minutes < 0 ? -offset_minutes : offset_minutes;
          Lei Zhang . unresolved

          Just use abs()?

          Line 189, Patchset 6 (Latest): "D:%04d%02d%02d%02d%02d%02d%c%02d'%02d'", local_time.tm_year + 1900,
          Lei Zhang . unresolved

          Instead of repeating line 177 with the timezone offset, how about just use the same string and then append the TZ offset here?

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Kuka
          Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: pdfium
          Gerrit-Branch: main
          Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
          Gerrit-Change-Number: 150390
          Gerrit-PatchSet: 6
          Gerrit-Owner: Kuka <tyck...@gmail.com>
          Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
          Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
          Gerrit-Attention: Kuka <tyck...@gmail.com>
          Gerrit-Comment-Date: Tue, 23 Jun 2026 18:21:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Kuka (Gerrit)

          unread,
          Jun 24, 2026, 10:47:22 AM (16 hours ago) Jun 24
          to pdfium...@luci-project-accounts.iam.gserviceaccount.com, Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
          Attention needed from Lei Zhang and Tom Sepez

          Kuka added 6 comments

          Patchset-level comments
          File-level comment, Patchset 7 (Latest):
          Kuka . resolved

          Thanks for the review. I addressed all comments in the latest patchset. PTAL when you have a chance.

          File core/fxcrt/fx_extension.h
          Line 164, Patchset 6:class ScopedTimeFunction {
          Lei Zhang . resolved

          Since these scoper classes are only used in tests, can they move into testing/utils/ instead?

          Kuka

          Done

          File fpdfsdk/fpdf_edit_embeddertest.cpp
          Line 6, Patchset 2:
          Tom Sepez . resolved

          nit: blank line after this header but not before to group c/c++ includes into sections.

          Kuka

          Done

          Lei Zhang

          Still need to swap the 2 lines so the C headers are grouped together.

          Kuka

          Done

          File fpdfsdk/fpdf_editpage.cpp
          Line 174, Patchset 6:ByteString FormatPDFDate(time_t current_time, tm local_time) {
          Lei Zhang . resolved

          Take a const-ref?

          Kuka

          Done

          Line 187, Patchset 6: offset_minutes < 0 ? -offset_minutes : offset_minutes;
          Lei Zhang . resolved

          Just use abs()?

          Kuka

          Done

          Line 189, Patchset 6: "D:%04d%02d%02d%02d%02d%02d%c%02d'%02d'", local_time.tm_year + 1900,
          Lei Zhang . resolved

          Instead of repeating line 177 with the timezone offset, how about just use the same string and then append the TZ offset here?

          Kuka

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Lei Zhang
          • Tom Sepez
          Submit Requirements:
          • requirement is not satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: pdfium
          Gerrit-Branch: main
          Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
          Gerrit-Change-Number: 150390
          Gerrit-PatchSet: 7
          Gerrit-Attention: Lei Zhang <the...@chromium.org>
          Gerrit-Attention: Tom Sepez <tse...@chromium.org>
          Gerrit-Comment-Date: Wed, 24 Jun 2026 14:47:15 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Lei Zhang <the...@chromium.org>
          unsatisfied_requirement
          open
          diffy

          Lei Zhang (Gerrit)

          unread,
          Jun 24, 2026, 1:31:29 PM (13 hours ago) Jun 24
          to Kuka, pdfium...@luci-project-accounts.iam.gserviceaccount.com, Tom Sepez, Lei Zhang, pdfium-...@googlegroups.com
          Attention needed from Kuka and Tom Sepez

          Lei Zhang added 2 comments

          File core/fxcrt/fx_extension.cpp
          Line 34, Patchset 7 (Latest):using TimeFunction = time_t (*)();
          Lei Zhang . unresolved

          These used useful in the header in the earlier patchset. They improve readability.

          File testing/utils/scoped_time_overrides.h
          Line 8, Patchset 7 (Latest):#include "core/fxcrt/fx_extension.h"
          Lei Zhang . unresolved

          Only used in the .cc file, unless fx_extension.h defines TimeFunction/LocaltimeFunction.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Kuka
          • Tom Sepez
          Submit Requirements:
            • requirement is not satisfiedCode-Owners
            • requirement is not satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: pdfium
            Gerrit-Branch: main
            Gerrit-Change-Id: I8dc9100199438350bd0f7f1f33b7aa07efefb1ef
            Gerrit-Change-Number: 150390
            Gerrit-PatchSet: 7
            Gerrit-Owner: Kuka <tyck...@gmail.com>
            Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
            Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
            Gerrit-Attention: Tom Sepez <tse...@chromium.org>
            Gerrit-Attention: Kuka <tyck...@gmail.com>
            Gerrit-Comment-Date: Wed, 24 Jun 2026 17:31:25 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            unsatisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages