@@ -63,23 +63,28 @@ static void test_time_close_hourly() {
6363
6464static void test_time_tz_in_session_slot_equiv () {
6565 std::printf (" test_time_tz_in_session_slot_equiv\n " );
66- // time("D", "America/New_York") binds the tz into the session slot. The
67- // engine must reinterpret it as the timezone (not a session) — previously
68- // it treated it as a session, matched no HHMM window, and returned na.
66+ // time("D", "America/New_York") binds the tz into the session slot. That is
67+ // an invalid session, which TV ignores entirely — it does NOT adopt the
68+ // string as the timezone. The daily boundary rolls at the chart/exchange
69+ // (UTC) timezone, exactly as a plain time("D") does. It must not be na, and
70+ // must NOT match the 3-arg explicit-tz form (which still rolls at NY).
6971 int64_t bar = 1775572200000LL ; // 2026-04-07 14:30 UTC = 10:30 NY (EDT)
7072 int64_t two_arg = pine_time (bar, " D" , " America/New_York" , " " , " 15" );
71- int64_t three_arg = pine_time (bar, " D" , " " , " America/New_York" , " 15" );
72- CHECK (!is_na (two_arg)); // was na for every bar (the bug)
73- CHECK (two_arg == three_arg); // reinterpreted identically to the 3-arg form
73+ int64_t plain = pine_time (bar, " D" , " " , " " , " 15" ); // time("D") → UTC/chart
74+ int64_t three_arg = pine_time (bar, " D" , " " , " America/New_York" , " 15" ); // explicit tz → NY
75+ CHECK (!is_na (two_arg)); // was na before PR#66; still not na
76+ CHECK (two_arg == plain); // invalid session tz-string ignored → rolls at UTC/chart
77+ CHECK (two_arg != three_arg); // explicit-tz 3-arg form still uses the given tz
7478}
7579
7680static void test_time_tz_in_session_daily_change () {
7781 std::printf (" test_time_tz_in_session_daily_change\n " );
78- // Bars in the same NY-day share the daily time; the next NY-day differs —
82+ // The tz-string session is ignored, so the daily boundary rolls at UTC.
83+ // Bars in the same UTC-day share the daily time; the next UTC-day differs —
7984 // this is what makes ta.change(time("D", tz)) fire once per day.
80- int64_t bar_a = 1775572200000LL ; // 2026-04-07 10 :30 NY
81- int64_t bar_b = bar_a + 3600000LL ; // +1h, same NY -day
82- int64_t bar_next = bar_a + 24LL * 3600000LL ; // +24h, next NY -day
85+ int64_t bar_a = 1775572200000LL ; // 2026-04-07 14 :30 UTC
86+ int64_t bar_b = bar_a + 3600000LL ; // +1h → 15:30 UTC , same UTC -day
87+ int64_t bar_next = bar_a + 24LL * 3600000LL ; // +24h, next UTC -day
8388 int64_t ta = pine_time (bar_a, " D" , " America/New_York" , " " , " 15" );
8489 int64_t tb = pine_time (bar_b, " D" , " America/New_York" , " " , " 15" );
8590 int64_t tn = pine_time (bar_next, " D" , " America/New_York" , " " , " 15" );
0 commit comments