File 2082-stdlib-Add-some-underscore-separators-for-readabilit.patch of Package erlang

From c538e8412f992177a4f5734fe614cd49bd9669a4 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Mon, 27 Sep 2021 14:31:27 +0200
Subject: [PATCH 2/2] stdlib: Add some underscore separators for readability

---
 lib/stdlib/src/calendar.erl        | 10 ++++----
 lib/stdlib/test/calendar_SUITE.erl | 40 +++++++++++++++---------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/stdlib/src/calendar.erl b/lib/stdlib/src/calendar.erl
index e9fcccaba8..3a0aba1a44 100644
--- a/lib/stdlib/src/calendar.erl
+++ b/lib/stdlib/src/calendar.erl
@@ -326,7 +326,7 @@ local_time_to_universal_time_dst(DateTime) ->
 -spec now_to_datetime(Now) -> datetime1970() when
       Now :: erlang:timestamp().
 now_to_datetime({MSec, Sec, _uSec}) ->
-    system_time_to_datetime(MSec*1000000 + Sec).
+    system_time_to_datetime(MSec*1_000_000 + Sec).
 
 -spec now_to_universal_time(Now) -> datetime1970() when
       Now :: erlang:timestamp().
@@ -754,13 +754,13 @@ copy_sign(N1, _N2) -> N1.
 
 factor(second)      -> 1;
 factor(millisecond) -> 1000;
-factor(microsecond) -> 1000000;
-factor(nanosecond)  -> 1000000000;
+factor(microsecond) -> 1_000_000;
+factor(nanosecond)  -> 1_000_000_000;
 factor(native)      -> erlang:convert_time_unit(1, second, native).
 
 log10(1000) -> 3;
-log10(1000000) -> 6;
-log10(1000000000) -> 9.
+log10(1_000_000) -> 6;
+log10(1_000_000_000) -> 9.
 
 pad(0, S) ->
     S;
diff --git a/lib/stdlib/test/calendar_SUITE.erl b/lib/stdlib/test/calendar_SUITE.erl
index 5642852211..c39da41ae9 100644
--- a/lib/stdlib/test/calendar_SUITE.erl
+++ b/lib/stdlib/test/calendar_SUITE.erl
@@ -223,12 +223,12 @@ rfc3339(Config) when is_list(Config) ->
     NaPerSec = erlang:convert_time_unit(1, second, native),
     "9999-12-31T23:59:59.999Z" = do_format_z(253402300799*NaPerSec+(NaPerSec-1), Na),
     "9999-12-31T23:59:59.999999Z" =
-        roundtrip_fmt_rfc3339_z(253402300799*1000000+999999, Mys),
+        roundtrip_fmt_rfc3339_z(253402300799*1_000_000+999_999, Mys),
     "9999-12-31T23:59:59.999999999Z" =
-        roundtrip_fmt_rfc3339_z(253402300799*1000000000+999999999, Ns),
+        roundtrip_fmt_rfc3339_z(253402300799*1_000_000_000+999_999_999, Ns),
     {'EXIT', _} = (catch do_format_z(253402300799+1, [])),
     {'EXIT', _} = (catch do_parse("9999-12-31T23:59:60Z", [])),
-    {'EXIT', _} = (catch do_format_z(253402300799*1000000000+999999999+1, Ns)),
+    {'EXIT', _} = (catch do_format_z(253402300799*1_000_000_000+999_999_999+1, Ns)),
     {'EXIT', _} = (catch do_parse("2010-04-11T22:35:41", [])), % OTP-16514
     253402300799 = do_parse("9999-12-31T23:59:59Z", []),
 
@@ -270,12 +270,12 @@ rfc3339(Config) when is_list(Config) ->
     Str = "2000-01-01T10:02:00+00:02",
     Str = do_format(TO, [{offset, 120}]),
     "2000-01-01T10:02:00.000+00:02" =
-        do_format(TO * 1000, [{offset, 120 * 1000}]++Ms),
+        do_format(TO * 1000, [{offset, 120_000}]++Ms),
     "2000-01-01T10:02:00.000000+00:02" =
-        do_format(TO * 1000 * 1000, [{offset, 120 * 1000 * 1000}]++Mys),
+        do_format(TO * 1_000_000, [{offset, 120_000_000}]++Mys),
     "2000-01-01T10:02:00.000000000+00:02" =
-        do_format(TO * 1000 * 1000 * 1000,
-                  [{offset, 120 * 1000 * 1000 * 1000}]++Ns),
+        do_format(TO * 1_000_000_000,
+                  [{offset, 120_000_000_000}]++Ns),
     "2000-01-01T10:02:00.000+00:02" =
         do_format(TO * NaPerSec, [{offset, 120 * NaPerSec}]++Na),
 
@@ -283,29 +283,29 @@ rfc3339(Config) when is_list(Config) ->
     NStr = "2000-01-01T09:58:00-00:02",
     NStr = do_format(TO, [{offset, -120}]),
     "2000-01-01T09:58:00.000-00:02" =
-        do_format(TO * 1000, [{offset, -120 * 1000}]++Ms),
+        do_format(TO * 1000, [{offset, -120_000}]++Ms),
     "2000-01-01T09:58:00.000-00:02" =
         do_format(TO * NaPerSec, [{offset, -120 * NaPerSec}]++Na),
     "2000-01-01T09:58:00.000000-00:02" =
-        do_format(TO * 1000 * 1000, [{offset, -120 * 1000 * 1000}]++Mys),
+        do_format(TO * 1_000_000, [{offset, -120_000_000}]++Mys),
     "2000-01-01T09:58:00.000000000-00:02" =
-        do_format(TO * 1000 * 1000 * 1000,
-                  [{offset, -120 * 1000 * 1000 * 1000}]++Ns),
+        do_format(TO * 1_000_000_000,
+                  [{offset, -120_000_000_000}]++Ns),
     "2000-01-01T09:58:00.000-00:02" =
-        do_format(TO * 1000, [{offset, -120 * 1000}]++Ms),
+        do_format(TO * 1000, [{offset, -120_000}]++Ms),
     "2000-01-01T09:58:00.000-00:02" =
         do_format(TO * NaPerSec, [{offset, -120 * NaPerSec}]++Na),
 
-    543210000 = do_parse("1970-01-01T00:00:00.54321Z", Ns),
-    54321000 = do_parse("1970-01-01T00:00:00.054321Z", Ns),
-    543210 = do_parse("1970-01-01T00:00:00.54321Z", Mys),
+    543_210_000 = do_parse("1970-01-01T00:00:00.54321Z", Ns),
+    543_210_00 = do_parse("1970-01-01T00:00:00.054321Z", Ns),
+    543_210 = do_parse("1970-01-01T00:00:00.54321Z", Mys),
     543 = do_parse("1970-01-01T00:00:00.54321Z", Ms),
     0 = do_parse("1970-01-01T00:00:00.000001Z", Ms),
     1 = do_parse("1970-01-01T00:00:00.000001Z", Mys),
     1000 = do_parse("1970-01-01T00:00:00.000001Z", Ns),
     0 = do_parse("1970-01-01Q00:00:00.00049Z", Ms),
     1 = do_parse("1970-01-01Q00:00:00.0005Z", Ms),
-    6543210 = do_parse("1970-01-01T00:00:06.54321Z", Mys),
+    6543_210 = do_parse("1970-01-01T00:00:06.54321Z", Mys),
     298815132000000 = do_parse("1979-06-21T12:12:12Z", Mys),
     -1613826000000000 = do_parse("1918-11-11T11:00:00Z", Mys),
     -1613833200000000 = do_parse("1918-11-11T11:00:00+02:00", Mys),
@@ -316,11 +316,11 @@ rfc3339(Config) when is_list(Config) ->
     "1970-01-01T00:00:00.001Z" = roundtrip_fmt_rfc3339_z(1, Ms),
     "1970-01-01T00:00:00.000001Z" = roundtrip_fmt_rfc3339_z(1, Mys),
     "1970-01-01T00:00:00.000000001Z" = roundtrip_fmt_rfc3339_z(1, Ns),
-    "1970-01-01T00:00:01.000000Z" = roundtrip_fmt_rfc3339_z(1000000, Mys),
-    "1970-01-01T00:00:00.543210Z" = roundtrip_fmt_rfc3339_z(543210, Mys),
+    "1970-01-01T00:00:01.000000Z" = roundtrip_fmt_rfc3339_z(1_000_000, Mys),
+    "1970-01-01T00:00:00.543210Z" = roundtrip_fmt_rfc3339_z(543_210, Mys),
     "1970-01-01T00:00:00.543Z" = roundtrip_fmt_rfc3339_z(543, Ms),
-    "1970-01-01T00:00:00.543210000Z" = roundtrip_fmt_rfc3339_z(543210000, Ns),
-    "1970-01-01T00:00:06.543210Z" = roundtrip_fmt_rfc3339_z(6543210, Mys),
+    "1970-01-01T00:00:00.543210000Z" = roundtrip_fmt_rfc3339_z(543_210_000, Ns),
+    "1970-01-01T00:00:06.543210Z" = roundtrip_fmt_rfc3339_z(6_543_210, Mys),
     "1979-06-21T12:12:12.000000Z" = roundtrip_fmt_rfc3339_z(298815132000000, Mys),
     "1918-11-11T13:00:00.000000Z" = roundtrip_fmt_rfc3339_z(-1613818800000000, Mys),
 
-- 
2.31.1

openSUSE Build Service is sponsored by