kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Averages_Mean time of day
C: #include<stdlib.h>
#include<math.h>
#include<stdio.h>

typedef struct
{
  int hour, minute, second;
} digitime;

double
timeToDegrees (digitime time)
{
  return (360 * time.hour / 24.0 + 360 * time.minute / (24 * 60.0) +
          360 * time.second / (24 * 3600.0));
}

digitime
timeFromDegrees (double angle)
{
  digitime d;
  double totalSeconds = 24 * 60 * 60 * angle / 360;

  d.second = (int) totalSeconds % 60;
  d.minute = ((int) totalSeconds % 3600 - d.second) / 60;
  d.hour = (int) totalSeconds / 3600;

  return d;
}

double
meanAngle (double *angles, int size)
{
  double y_part = 0, x_part = 0;
  int i;

  for (i = 0; i < size; i++)
    {
      x_part += cos (angles[i] * M_PI / 180);
      y_part += sin (angles[i] * M_PI / 180);
    }

  return atan2 (y_part / size, x_part / size) * 180 / M_PI;
}

int
main ()
{
  digitime *set, meanTime;
  int inputs, i;
  double *angleSet, angleMean;

  printf ("Enter number of inputs : ");
  scanf ("%d", &inputs);
  set = malloc (inputs * sizeof (digitime));
  angleSet = malloc (inputs * sizeof (double));
  printf ("\n\nEnter the data separated by a space between each unit : ");

  for (i = 0; i < inputs; i++)
    {
      scanf ("%d:%d:%d", &set[i].hour, &set[i].minute, &set[i].second);
      angleSet[i] = timeToDegrees (set[i]);
    }

  meanTime = timeFromDegrees (360 + meanAngle (angleSet, inputs));

  printf ("\n\nThe mean time is : %d:%d:%d", meanTime.hour, meanTime.minute,
          meanTime.second);
  return 0;
}

VB: Public Sub mean_time()
    Dim angles() As Double
    s = [{"23:00:17","23:40:20","00:12:45","00:17:19"}]
    For i = 1 To UBound(s)
        s(i) = 360 * TimeValue(s(i))
    Next i
    Debug.Print Format(mean_angle(s) / 360 + 1, "hh:mm:ss")
End Sub
Task: Averages_Mean time of day
C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

namespace RosettaCode;

class Program
{
    private const int SecondsPerDay = 60 * 60 * 24;

    static void Main()
    {
        var digitimes = new List<TimeSpan>();

        Console.WriteLine("Enter times, end with no input: ");
        while (true) {
            string input = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input)) break;
            if (TimeSpan.TryParse(input, out var digitime)) {
                digitimes.Add(digitime);
            } else {
                Console.WriteLine("Seems this is wrong input: ignoring time");
            }
        }
        if(digitimes.Count() > 0)
            Console.WriteLine($"The mean time is : {MeanTime(digitimes)}");
    }

    public static TimeSpan MeanTime(IEnumerable<TimeSpan> ts) => FromDegrees(MeanAngle(ts.Select(ToDegrees)));
    public static double ToDegrees(TimeSpan ts) => ts.TotalSeconds * 360d / SecondsPerDay;
    public static TimeSpan FromDegrees(double degrees) => TimeSpan.FromSeconds((int)(degrees * SecondsPerDay / 360));

    public static double MeanAngle(IEnumerable<double> angles)
    {
        var x = angles.Average(a => Cos(a * PI / 180));
        var y = angles.Average(a => Sin(a * PI / 180));
        return (Atan2(y, x) * 180 / PI + 360) % 360;
    }
}

C++: #include <iomanip>
#include <iostream>
#include <vector>

#define _USE_MATH_DEFINES
#include <math.h>

struct Time {
    int hour, minute, second;

    friend std::ostream &operator<<(std::ostream &, const Time &);
};

std::ostream &operator<<(std::ostream &os, const Time &t) {
    return os << std::setfill('0')
        << std::setw(2) << t.hour << ':'
        << std::setw(2) << t.minute << ':'
        << std::setw(2) << t.second;
}

double timeToDegrees(Time &&t) {
    return 360.0 * t.hour / 24.0
        + 360.0 * t.minute / (24 * 60.0)
        + 360.0 * t.second / (24 * 3600.0);
}

Time degreesToTime(double angle) {
    while (angle < 0.0) {
        angle += 360.0;
    }
    while (angle > 360.0) {
        angle -= 360.0;
    }

    double totalSeconds = 24.0 * 60 * 60 * angle / 360;
    Time t;

    t.second = (int)totalSeconds % 60;
    t.minute = ((int)totalSeconds % 3600 - t.second) / 60;
    t.hour = (int)totalSeconds / 3600;

    return t;
}

double meanAngle(const std::vector<double> &angles) {
    double yPart = 0.0, xPart = 0.0;
    for (auto a : angles) {
        xPart += cos(a * M_PI / 180);
        yPart += sin(a * M_PI / 180);
    }
    return atan2(yPart / angles.size(), xPart / angles.size()) * 180 / M_PI;
}

int main() {
    std::vector<double> tv;
    tv.push_back(timeToDegrees({ 23, 0, 17 }));
    tv.push_back(timeToDegrees({ 23, 40, 20 }));
    tv.push_back(timeToDegrees({ 0, 12, 45 }));
    tv.push_back(timeToDegrees({ 0, 17, 19 }));

    double ma = meanAngle(tv);
    auto mt = degreesToTime(ma);
    std::cout << mt << '\n';

    return 0;
}
Task: Averages_Mean time of day
C++: #include <iomanip>
#include <iostream>
#include <vector>

#define _USE_MATH_DEFINES
#include <math.h>

struct Time {
    int hour, minute, second;

    friend std::ostream &operator<<(std::ostream &, const Time &);
};

std::ostream &operator<<(std::ostream &os, const Time &t) {
    return os << std::setfill('0')
        << std::setw(2) << t.hour << ':'
        << std::setw(2) << t.minute << ':'
        << std::setw(2) << t.second;
}

double timeToDegrees(Time &&t) {
    return 360.0 * t.hour / 24.0
        + 360.0 * t.minute / (24 * 60.0)
        + 360.0 * t.second / (24 * 3600.0);
}

Time degreesToTime(double angle) {
    while (angle < 0.0) {
        angle += 360.0;
    }
    while (angle > 360.0) {
        angle -= 360.0;
    }

    double totalSeconds = 24.0 * 60 * 60 * angle / 360;
    Time t;

    t.second = (int)totalSeconds % 60;
    t.minute = ((int)totalSeconds % 3600 - t.second) / 60;
    t.hour = (int)totalSeconds / 3600;

    return t;
}

double meanAngle(const std::vector<double> &angles) {
    double yPart = 0.0, xPart = 0.0;
    for (auto a : angles) {
        xPart += cos(a * M_PI / 180);
        yPart += sin(a * M_PI / 180);
    }
    return atan2(yPart / angles.size(), xPart / angles.size()) * 180 / M_PI;
}

int main() {
    std::vector<double> tv;
    tv.push_back(timeToDegrees({ 23, 0, 17 }));
    tv.push_back(timeToDegrees({ 23, 40, 20 }));
    tv.push_back(timeToDegrees({ 0, 12, 45 }));
    tv.push_back(timeToDegrees({ 0, 17, 19 }));

    double ma = meanAngle(tv);
    auto mt = degreesToTime(ma);
    std::cout << mt << '\n';

    return 0;
}

Python: from cmath import rect, phase
from math import radians, degrees


def mean_angle(deg):
    return degrees(phase(sum(rect(1, radians(d)) for d in deg)/len(deg)))

def mean_time(times):
    t = (time.split(':') for time in times)
    seconds = ((float(s) + int(m) * 60 + int(h) * 3600) 
               for h, m, s in t)
    day = 24 * 60 * 60
    to_angles = [s * 360. / day for s in seconds]
    mean_as_angle = mean_angle(to_angles)
    mean_seconds = mean_as_angle * day / 360.
    if mean_seconds < 0:
        mean_seconds += day
    h, m = divmod(mean_seconds, 3600)
    m, s = divmod(m, 60)
    return '%02i:%02i:%02i' % (h, m, s)


if __name__ == '__main__':
    print( mean_time(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) )
Task: Averages_Mean time of day
C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

namespace RosettaCode;

class Program
{
    private const int SecondsPerDay = 60 * 60 * 24;

    static void Main()
    {
        var digitimes = new List<TimeSpan>();

        Console.WriteLine("Enter times, end with no input: ");
        while (true) {
            string input = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input)) break;
            if (TimeSpan.TryParse(input, out var digitime)) {
                digitimes.Add(digitime);
            } else {
                Console.WriteLine("Seems this is wrong input: ignoring time");
            }
        }
        if(digitimes.Count() > 0)
            Console.WriteLine($"The mean time is : {MeanTime(digitimes)}");
    }

    public static TimeSpan MeanTime(IEnumerable<TimeSpan> ts) => FromDegrees(MeanAngle(ts.Select(ToDegrees)));
    public static double ToDegrees(TimeSpan ts) => ts.TotalSeconds * 360d / SecondsPerDay;
    public static TimeSpan FromDegrees(double degrees) => TimeSpan.FromSeconds((int)(degrees * SecondsPerDay / 360));

    public static double MeanAngle(IEnumerable<double> angles)
    {
        var x = angles.Average(a => Cos(a * PI / 180));
        var y = angles.Average(a => Sin(a * PI / 180));
        return (Atan2(y, x) * 180 / PI + 360) % 360;
    }
}

Java: public class MeanTimeOfDay {
    
    static double meanAngle(double[] angles) {
        int len = angles.length;
        double sinSum = 0.0;
        for (int i = 0; i < len; i++) {
            sinSum += Math.sin(angles[i] * Math.PI / 180.0);
        }
 
        double cosSum = 0.0;
        for (int i = 0; i < len; i++) {
            cosSum += Math.cos(angles[i] * Math.PI / 180.0);
        }

        return Math.atan2(sinSum / len, cosSum / len) * 180.0 / Math.PI;
    }

    
    static int timeToSecs(String t) {
        int hours = Integer.parseInt(t.substring(0, 2));
        int mins  = Integer.parseInt(t.substring(3, 5));
        int secs  = Integer.parseInt(t.substring(6, 8));
        return 3600 * hours + 60 * mins + secs;
    }

    
    static double timeToDegrees(String t) {
        return timeToSecs(t) / 240.0;
    }

    static String degreesToTime(double d) {
        if (d < 0.0) d += 360.0;
        int secs  = (int)(d * 240.0);
        int hours = secs / 3600;
        int mins  = secs % 3600;
        secs = mins % 60;
        mins /= 60;
        return String.format("%2d:%2d:%2d", hours, mins, secs);
    }

    public static void main(String[] args) {
        String[] tm = {"23:00:17", "23:40:20", "00:12:45", "00:17:19"};
        double[] angles = new double[4];
        for (int i = 0; i < 4; i++) angles[i] = timeToDegrees(tm[i]);        
        double mean = meanAngle(angles);
        System.out.println("Average time is : " + degreesToTime(mean));
    }
}
Task: Averages_Mean time of day
C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

namespace RosettaCode;

class Program
{
    private const int SecondsPerDay = 60 * 60 * 24;

    static void Main()
    {
        var digitimes = new List<TimeSpan>();

        Console.WriteLine("Enter times, end with no input: ");
        while (true) {
            string input = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input)) break;
            if (TimeSpan.TryParse(input, out var digitime)) {
                digitimes.Add(digitime);
            } else {
                Console.WriteLine("Seems this is wrong input: ignoring time");
            }
        }
        if(digitimes.Count() > 0)
            Console.WriteLine($"The mean time is : {MeanTime(digitimes)}");
    }

    public static TimeSpan MeanTime(IEnumerable<TimeSpan> ts) => FromDegrees(MeanAngle(ts.Select(ToDegrees)));
    public static double ToDegrees(TimeSpan ts) => ts.TotalSeconds * 360d / SecondsPerDay;
    public static TimeSpan FromDegrees(double degrees) => TimeSpan.FromSeconds((int)(degrees * SecondsPerDay / 360));

    public static double MeanAngle(IEnumerable<double> angles)
    {
        var x = angles.Average(a => Cos(a * PI / 180));
        var y = angles.Average(a => Sin(a * PI / 180));
        return (Atan2(y, x) * 180 / PI + 360) % 360;
    }
}

Python: from cmath import rect, phase
from math import radians, degrees


def mean_angle(deg):
    return degrees(phase(sum(rect(1, radians(d)) for d in deg)/len(deg)))

def mean_time(times):
    t = (time.split(':') for time in times)
    seconds = ((float(s) + int(m) * 60 + int(h) * 3600) 
               for h, m, s in t)
    day = 24 * 60 * 60
    to_angles = [s * 360. / day for s in seconds]
    mean_as_angle = mean_angle(to_angles)
    mean_seconds = mean_as_angle * day / 360.
    if mean_seconds < 0:
        mean_seconds += day
    h, m = divmod(mean_seconds, 3600)
    m, s = divmod(m, 60)
    return '%02i:%02i:%02i' % (h, m, s)


if __name__ == '__main__':
    print( mean_time(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) )
Task: Averages_Mean time of day
Java: public class MeanTimeOfDay {
    
    static double meanAngle(double[] angles) {
        int len = angles.length;
        double sinSum = 0.0;
        for (int i = 0; i < len; i++) {
            sinSum += Math.sin(angles[i] * Math.PI / 180.0);
        }
 
        double cosSum = 0.0;
        for (int i = 0; i < len; i++) {
            cosSum += Math.cos(angles[i] * Math.PI / 180.0);
        }

        return Math.atan2(sinSum / len, cosSum / len) * 180.0 / Math.PI;
    }

    
    static int timeToSecs(String t) {
        int hours = Integer.parseInt(t.substring(0, 2));
        int mins  = Integer.parseInt(t.substring(3, 5));
        int secs  = Integer.parseInt(t.substring(6, 8));
        return 3600 * hours + 60 * mins + secs;
    }

    
    static double timeToDegrees(String t) {
        return timeToSecs(t) / 240.0;
    }

    static String degreesToTime(double d) {
        if (d < 0.0) d += 360.0;
        int secs  = (int)(d * 240.0);
        int hours = secs / 3600;
        int mins  = secs % 3600;
        secs = mins % 60;
        mins /= 60;
        return String.format("%2d:%2d:%2d", hours, mins, secs);
    }

    public static void main(String[] args) {
        String[] tm = {"23:00:17", "23:40:20", "00:12:45", "00:17:19"};
        double[] angles = new double[4];
        for (int i = 0; i < 4; i++) angles[i] = timeToDegrees(tm[i]);        
        double mean = meanAngle(angles);
        System.out.println("Average time is : " + degreesToTime(mean));
    }
}

Python: from cmath import rect, phase
from math import radians, degrees


def mean_angle(deg):
    return degrees(phase(sum(rect(1, radians(d)) for d in deg)/len(deg)))

def mean_time(times):
    t = (time.split(':') for time in times)
    seconds = ((float(s) + int(m) * 60 + int(h) * 3600) 
               for h, m, s in t)
    day = 24 * 60 * 60
    to_angles = [s * 360. / day for s in seconds]
    mean_as_angle = mean_angle(to_angles)
    mean_seconds = mean_as_angle * day / 360.
    if mean_seconds < 0:
        mean_seconds += day
    h, m = divmod(mean_seconds, 3600)
    m, s = divmod(m, 60)
    return '%02i:%02i:%02i' % (h, m, s)


if __name__ == '__main__':
    print( mean_time(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) )
Task: Averages_Mean time of day
C++: #include <iomanip>
#include <iostream>
#include <vector>

#define _USE_MATH_DEFINES
#include <math.h>

struct Time {
    int hour, minute, second;

    friend std::ostream &operator<<(std::ostream &, const Time &);
};

std::ostream &operator<<(std::ostream &os, const Time &t) {
    return os << std::setfill('0')
        << std::setw(2) << t.hour << ':'
        << std::setw(2) << t.minute << ':'
        << std::setw(2) << t.second;
}

double timeToDegrees(Time &&t) {
    return 360.0 * t.hour / 24.0
        + 360.0 * t.minute / (24 * 60.0)
        + 360.0 * t.second / (24 * 3600.0);
}

Time degreesToTime(double angle) {
    while (angle < 0.0) {
        angle += 360.0;
    }
    while (angle > 360.0) {
        angle -= 360.0;
    }

    double totalSeconds = 24.0 * 60 * 60 * angle / 360;
    Time t;

    t.second = (int)totalSeconds % 60;
    t.minute = ((int)totalSeconds % 3600 - t.second) / 60;
    t.hour = (int)totalSeconds / 3600;

    return t;
}

double meanAngle(const std::vector<double> &angles) {
    double yPart = 0.0, xPart = 0.0;
    for (auto a : angles) {
        xPart += cos(a * M_PI / 180);
        yPart += sin(a * M_PI / 180);
    }
    return atan2(yPart / angles.size(), xPart / angles.size()) * 180 / M_PI;
}

int main() {
    std::vector<double> tv;
    tv.push_back(timeToDegrees({ 23, 0, 17 }));
    tv.push_back(timeToDegrees({ 23, 40, 20 }));
    tv.push_back(timeToDegrees({ 0, 12, 45 }));
    tv.push_back(timeToDegrees({ 0, 17, 19 }));

    double ma = meanAngle(tv);
    auto mt = degreesToTime(ma);
    std::cout << mt << '\n';

    return 0;
}

Java: public class MeanTimeOfDay {
    
    static double meanAngle(double[] angles) {
        int len = angles.length;
        double sinSum = 0.0;
        for (int i = 0; i < len; i++) {
            sinSum += Math.sin(angles[i] * Math.PI / 180.0);
        }
 
        double cosSum = 0.0;
        for (int i = 0; i < len; i++) {
            cosSum += Math.cos(angles[i] * Math.PI / 180.0);
        }

        return Math.atan2(sinSum / len, cosSum / len) * 180.0 / Math.PI;
    }

    
    static int timeToSecs(String t) {
        int hours = Integer.parseInt(t.substring(0, 2));
        int mins  = Integer.parseInt(t.substring(3, 5));
        int secs  = Integer.parseInt(t.substring(6, 8));
        return 3600 * hours + 60 * mins + secs;
    }

    
    static double timeToDegrees(String t) {
        return timeToSecs(t) / 240.0;
    }

    static String degreesToTime(double d) {
        if (d < 0.0) d += 360.0;
        int secs  = (int)(d * 240.0);
        int hours = secs / 3600;
        int mins  = secs % 3600;
        secs = mins % 60;
        mins /= 60;
        return String.format("%2d:%2d:%2d", hours, mins, secs);
    }

    public static void main(String[] args) {
        String[] tm = {"23:00:17", "23:40:20", "00:12:45", "00:17:19"};
        double[] angles = new double[4];
        for (int i = 0; i < 4; i++) angles[i] = timeToDegrees(tm[i]);        
        double mean = meanAngle(angles);
        System.out.println("Average time is : " + degreesToTime(mean));
    }
}
Task: Averages_Mean time of day
C++: #include <iomanip>
#include <iostream>
#include <vector>

#define _USE_MATH_DEFINES
#include <math.h>

struct Time {
    int hour, minute, second;

    friend std::ostream &operator<<(std::ostream &, const Time &);
};

std::ostream &operator<<(std::ostream &os, const Time &t) {
    return os << std::setfill('0')
        << std::setw(2) << t.hour << ':'
        << std::setw(2) << t.minute << ':'
        << std::setw(2) << t.second;
}

double timeToDegrees(Time &&t) {
    return 360.0 * t.hour / 24.0
        + 360.0 * t.minute / (24 * 60.0)
        + 360.0 * t.second / (24 * 3600.0);
}

Time degreesToTime(double angle) {
    while (angle < 0.0) {
        angle += 360.0;
    }
    while (angle > 360.0) {
        angle -= 360.0;
    }

    double totalSeconds = 24.0 * 60 * 60 * angle / 360;
    Time t;

    t.second = (int)totalSeconds % 60;
    t.minute = ((int)totalSeconds % 3600 - t.second) / 60;
    t.hour = (int)totalSeconds / 3600;

    return t;
}

double meanAngle(const std::vector<double> &angles) {
    double yPart = 0.0, xPart = 0.0;
    for (auto a : angles) {
        xPart += cos(a * M_PI / 180);
        yPart += sin(a * M_PI / 180);
    }
    return atan2(yPart / angles.size(), xPart / angles.size()) * 180 / M_PI;
}

int main() {
    std::vector<double> tv;
    tv.push_back(timeToDegrees({ 23, 0, 17 }));
    tv.push_back(timeToDegrees({ 23, 40, 20 }));
    tv.push_back(timeToDegrees({ 0, 12, 45 }));
    tv.push_back(timeToDegrees({ 0, 17, 19 }));

    double ma = meanAngle(tv);
    auto mt = degreesToTime(ma);
    std::cout << mt << '\n';

    return 0;
}

VB: Public Sub mean_time()
    Dim angles() As Double
    s = [{"23:00:17","23:40:20","00:12:45","00:17:19"}]
    For i = 1 To UBound(s)
        s(i) = 360 * TimeValue(s(i))
    Next i
    Debug.Print Format(mean_angle(s) / 360 + 1, "hh:mm:ss")
End Sub
Task: Averages_Mean time of day
Java: public class MeanTimeOfDay {
    
    static double meanAngle(double[] angles) {
        int len = angles.length;
        double sinSum = 0.0;
        for (int i = 0; i < len; i++) {
            sinSum += Math.sin(angles[i] * Math.PI / 180.0);
        }
 
        double cosSum = 0.0;
        for (int i = 0; i < len; i++) {
            cosSum += Math.cos(angles[i] * Math.PI / 180.0);
        }

        return Math.atan2(sinSum / len, cosSum / len) * 180.0 / Math.PI;
    }

    
    static int timeToSecs(String t) {
        int hours = Integer.parseInt(t.substring(0, 2));
        int mins  = Integer.parseInt(t.substring(3, 5));
        int secs  = Integer.parseInt(t.substring(6, 8));
        return 3600 * hours + 60 * mins + secs;
    }

    
    static double timeToDegrees(String t) {
        return timeToSecs(t) / 240.0;
    }

    static String degreesToTime(double d) {
        if (d < 0.0) d += 360.0;
        int secs  = (int)(d * 240.0);
        int hours = secs / 3600;
        int mins  = secs % 3600;
        secs = mins % 60;
        mins /= 60;
        return String.format("%2d:%2d:%2d", hours, mins, secs);
    }

    public static void main(String[] args) {
        String[] tm = {"23:00:17", "23:40:20", "00:12:45", "00:17:19"};
        double[] angles = new double[4];
        for (int i = 0; i < 4; i++) angles[i] = timeToDegrees(tm[i]);        
        double mean = meanAngle(angles);
        System.out.println("Average time is : " + degreesToTime(mean));
    }
}

VB: Public Sub mean_time()
    Dim angles() As Double
    s = [{"23:00:17","23:40:20","00:12:45","00:17:19"}]
    For i = 1 To UBound(s)
        s(i) = 360 * TimeValue(s(i))
    Next i
    Debug.Print Format(mean_angle(s) / 360 + 1, "hh:mm:ss")
End Sub
Task: Averages_Mean time of day
Python: from cmath import rect, phase
from math import radians, degrees


def mean_angle(deg):
    return degrees(phase(sum(rect(1, radians(d)) for d in deg)/len(deg)))

def mean_time(times):
    t = (time.split(':') for time in times)
    seconds = ((float(s) + int(m) * 60 + int(h) * 3600) 
               for h, m, s in t)
    day = 24 * 60 * 60
    to_angles = [s * 360. / day for s in seconds]
    mean_as_angle = mean_angle(to_angles)
    mean_seconds = mean_as_angle * day / 360.
    if mean_seconds < 0:
        mean_seconds += day
    h, m = divmod(mean_seconds, 3600)
    m, s = divmod(m, 60)
    return '%02i:%02i:%02i' % (h, m, s)


if __name__ == '__main__':
    print( mean_time(["23:00:17", "23:40:20", "00:12:45", "00:17:19"]) )

VB: Public Sub mean_time()
    Dim angles() As Double
    s = [{"23:00:17","23:40:20","00:12:45","00:17:19"}]
    For i = 1 To UBound(s)
        s(i) = 360 * TimeValue(s(i))
    Next i
    Debug.Print Format(mean_angle(s) / 360 + 1, "hh:mm:ss")
End Sub
Task: Averages_Mean time of day
C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

namespace RosettaCode;

class Program
{
    private const int SecondsPerDay = 60 * 60 * 24;

    static void Main()
    {
        var digitimes = new List<TimeSpan>();

        Console.WriteLine("Enter times, end with no input: ");
        while (true) {
            string input = Console.ReadLine();
            if (string.IsNullOrWhiteSpace(input)) break;
            if (TimeSpan.TryParse(input, out var digitime)) {
                digitimes.Add(digitime);
            } else {
                Console.WriteLine("Seems this is wrong input: ignoring time");
            }
        }
        if(digitimes.Count() > 0)
            Console.WriteLine($"The mean time is : {MeanTime(digitimes)}");
    }

    public static TimeSpan MeanTime(IEnumerable<TimeSpan> ts) => FromDegrees(MeanAngle(ts.Select(ToDegrees)));
    public static double ToDegrees(TimeSpan ts) => ts.TotalSeconds * 360d / SecondsPerDay;
    public static TimeSpan FromDegrees(double degrees) => TimeSpan.FromSeconds((int)(degrees * SecondsPerDay / 360));

    public static double MeanAngle(IEnumerable<double> angles)
    {
        var x = angles.Average(a => Cos(a * PI / 180));
        var y = angles.Average(a => Sin(a * PI / 180));
        return (Atan2(y, x) * 180 / PI + 360) % 360;
    }
}

VB: Public Sub mean_time()
    Dim angles() As Double
    s = [{"23:00:17","23:40:20","00:12:45","00:17:19"}]
    For i = 1 To UBound(s)
        s(i) = 360 * TimeValue(s(i))
    Next i
    Debug.Print Format(mean_angle(s) / 360 + 1, "hh:mm:ss")
End Sub