'Separating List of unix times into separate nested list in C#

I have a list of unix times that looks like this:

List<long> unixTimes = new List<long>()
            {
                1635123603, // -> Monday, October 25, 2021 1:00:03 AM
                1635123608, // -> Monday, October 25, 2021 1:00:08 AM
                1635123614, // -> Monday, October 25, 2021 1:00:14 AM

                1635123731, // -> Monday, October 25, 2021 1:02:11 AM
                1635123737, // -> Monday, October 25, 2021 1:02:17 AM
                1635123742, // -> Monday, October 25, 2021 1:02:22 AM

                1635123842, // -> Monday, October 25, 2021 1:04:02 AM
                1635123848, // -> Monday, October 25, 2021 1:04:08 AM
                1635123852  // -> Monday, October 25, 2021 1:04:12 AM
            };

My my goal is to have a nested list List<List<long>> that is going to contain unix times for each separate minute. In other words, my final list should look something like this:

List<List<long>> unixTimesMinute = new List<List<long>>();

unixTimesMinute.Add(new List<long>() { 1635123603, 1635123608, 1635123614 });
unixTimesMinute.Add(new List<long>() { 1635123731, 1635123737, 1635123742 });
unixTimesMinute.Add(new List<long>() { 1635123842, 1635123848, 1635123852 });

Do you have any ideas how this could be done easily ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source