scripts/cndp/conversion_timestamp_to_seconds.php

429 lines
5.7 KiB
PHP
Raw Permalink Normal View History

2023-01-12 16:18:15 +01:00
<?php
// coller ici les données de timestamp pour les convertir
$data = [" 00:10:47.000"
, "00:02:01.000"
, "00:01:47.000"
, "00:04:04.862"
, "00:12:28.000"
, "00:01:10.000"
, "00:02:54.000"
, "00:01:58.000"
, "00:01:54.000"
, "00:14:23.000"
, "00:01:33.000"
, "00:01:31.000"
, "00:04:22.000"
, "00:00:53.000"
, "00:06:37.000"
, "00:01:22.000"
, "00:12:11.000"
, "00:16:13.000"
, "00:00:56.000"
];
2023-01-16 16:13:45 +01:00
$data = ["
00:10:47.000
00:02:01.000
00:01:47.000
00:04:04.862
00:12:28.000
00:01:10.000
00:02:54.000
00:01:58.000
00:01:54.000
00:14:23.000
00:01:33.000
00:01:31.000
00:04:22.000
00:00:53.000
00:06:37.000
00:01:22.000
00:12:11.000
00:16:13.000
00:00:56.000
99:99:99.000
99:99:99.000
99:99:99.000
00:10:18.000
00:03:24.000
00:14:24.000
00:01:15.000
00:05:09.000
00:00:56.000
00:22:05.641
00:13:07.000
00:01:32.000
00:09:44.000
00:15:34.000
00:01:58.000
00:02:24.000
00:01:30.000
00:01:24.000
00:01:01.000
00:02:06.000
00:00:57.000
00:13:45.000
00:02:05.000
00:04:10.000
00:00:41.000
00:02:03.000
00:16:03.000
00:00:05.000
99:99:99.000
99:99:99.000
99:99:99.000
00:04:04.862
00:14:23.000
00:02:01.000
00:01:10.000
00:02:54.000
00:01:58.000
00:04:23.000
00:01:33.000
00:00:53.000
00:01:31.000
00:10:47.000
00:12:11.000
00:01:54.000
00:01:22.000
00:06:36.000
00:12:28.000
00:00:56.000
00:16:13.000
00:01:47.000
99:99:99.000
99:99:99.000
99:99:99.000
00:18:11.000
00:02:48.000
00:02:10.000
00:02:08.000
00:03:37.000
00:14:32.061
00:00:31.000
00:09:16.000
00:02:05.000
00:00:55.000
00:02:11.000
00:08:24.000
00:02:16.000
00:04:10.000
00:07:07.000
00:02:19.000
00:04:32.000
00:02:02.000
00:02:19.000
00:03:05.000
00:02:57.000
00:07:23.000
00:08:00.000
00:02:38.000
00:02:45.000
00:28:39.000
00:01:25.000
00:07:16.000
00:06:06.000
00:02:11.000
00:01:56.000
00:02:56.000
99:99:99.000
99:99:99.000
99:99:99.000
00:03:03.000
00:04:02.000
00:05:03.000
00:08:02.000
00:01:11.000
00:03:33.000
00:01:31.000
00:04:03.000
00:01:52.000
00:04:27.000
00:05:32.000
00:00:51.000
00:01:31.000
00:01:05.000
00:02:34.000
00:07:40.000
00:02:08.000
00:00:43.000
00:01:23.000
00:02:20.000
00:04:01.000
00:02:40.000
00:08:40.000
00:03:15.000
00:01:09.000
00:04:21.000
00:02:09.000
00:02:25.000
00:00:15.000
00:04:25.000
00:02:38.000
00:00:15.000
00:04:36.000
00:01:16.000
00:07:45.000
00:10:14.000
00:07:14.000
00:06:47.000
00:02:47.000
00:04:08.000
00:26:37.000
00:02:42.000
00:03:41.049
00:02:15.000
00:02:07.000
"
];
2023-02-16 14:49:46 +01:00
// 2023-02-02
2023-01-16 16:13:45 +01:00
2023-02-16 14:49:46 +01:00
$data = ['00:06:31.000
00:04:48.639
00:02:21.000
00:01:13.000
00:03:43.000
00:13:41.000
00:01:21.000
00:04:39.000
00:01:16.000
00:03:39.000
00:03:58.000
00:00:49.000
00:08:27.000
00:04:10.000
'];
// intervenants selon Le Bétonnier
$data = ['00:08:24.000
00:09:16.000
00:07:07.000
00:04:32.000
00:03:05.000
00:07:23.000
00:10:47.000
00:12:11.000
00:06:36.000
00:16:13.000
00:10:45.000
00:00:43.000
00:20:18.000
00:18:42.000
00:10:18.000
00:01:32.000
00:15:34.000
00:04:02.000
00:01:52.000
00:01:11.000
00:01:31.000
00:04:03.000
00:04:27.000
00:05:32.000
00:00:51.000
00:04:01.000
00:02:40.000
00:03:15.000
00:01:09.000
00:04:21.000
00:01:31.000
00:02:25.000
00:06:47.000
00:04:25.000
00:04:36.000
00:01:16.000
00:07:14.000
00:04:08.000
00:03:03.000
00:02:15.000
00:04:50.000
00:02:28.000
00:03:58.000
00:07:51.000
00:06:29.000
00:10:02.000
00:03:46.000
00:11:29.000
00:07:27.000
00:26:03.000
00:09:09.000
00:17:43.000
00:15:08.000
00:12:21.000
00:15:29.000
00:02:48.000
00:02:12.000
00:15:12.000
00:19:19.000
00:06:31.000
00:02:21.000
00:01:13.000
00:01:21.000
00:04:39.000
00:01:16.000
00:03:39.000
00:03:58.000
00:00:49.000
00:08:27.000
00:04:10.000
00:02:48.000
00:02:10.000
00:02:08.000
00:00:31.000
00:02:05.000
00:00:55.000
00:02:11.000
00:02:16.000
00:02:19.000
00:02:02.000
00:02:19.000
00:02:57.000
00:02:38.000
00:02:45.000
00:01:25.000
00:02:11.000
00:01:56.000
00:02:56.000
00:02:01.000
00:01:58.000
00:01:33.000
00:00:53.000
00:01:33.000
00:01:22.000
00:00:56.000
00:01:47.000
00:01:57.000
00:01:09.000
00:01:07.000
00:00:09.000
00:06:29.555
00:02:18.000
00:01:38.000
00:01:52.000
00:01:36.000
00:00:31.000
00:00:49.000
00:00:45.000
00:00:23.000
00:01:49.000
00:02:05.000
00:02:36.000
00:01:00.000
00:03:24.000
00:01:15.000
00:00:56.000
00:01:58.000
00:02:24.000
00:01:30.000
00:01:24.000
00:01:01.000
00:02:06.000
00:00:57.000
00:02:05.000
00:00:41.000
00:02:03.000
00:00:05.000
00:03:33.000
00:01:05.000
00:02:34.000
00:02:08.000
00:00:43.000
00:01:23.000
00:02:20.000
00:02:09.000
00:00:14.000
00:02:38.000
00:00:15.000
00:02:47.000
00:02:42.000
00:03:37.000
00:02:07.000
00:01:26.000
00:00:24.000
00:04:35.000
00:00:57.000
00:01:31.000
00:03:21.000
00:01:37.000
00:00:31.000
00:02:32.000
00:02:32.000
00:05:36.000
00:03:55.000
00:01:33.000
00:01:34.000
00:02:23.000
00:02:06.000
00:02:03.000
00:02:41.000
00:02:10.000
00:02:04.000
00:01:22.000
00:13:08.000
00:22:08.000
00:00:59.000
00:15:02.000
00:13:35.000
00:13:20.000
00:17:34.000
00:13:34.000
00:01:53.000
00:01:57.000
00:16:17.000
00:02:08.000
00:04:48.000
00:16:00.000
00:00:14.000
00:00:51.000
00:02:06.000
00:01:19.000
00:03:36.000
00:01:30.000
00:06:00.000
00:01:53.000
00:07:00.000
00:02:05.000
00:02:41.000
00:00:51.000
00:03:33.000
00:00:48.000
00:01:53.000
00:01:51.275
00:02:11.000
00:01:15.000
00:08:53.000
00:14:55.000
00:02:08.000
00:01:20.000
00:13:41.000
'];
2023-01-16 16:13:45 +01:00
2023-02-16 14:49:46 +01:00
$data = explode("\n", $data[0]);
2023-01-16 16:13:45 +01:00
2023-02-16 14:49:46 +01:00
//var_dump($data);
2023-01-16 16:13:45 +01:00
2023-01-12 16:18:15 +01:00
$results = [];
foreach ($data as $datum) {
2023-02-16 14:49:46 +01:00
if ($datum) {
2023-01-16 16:13:45 +01:00
2023-02-16 14:49:46 +01:00
$results[] = convertTimeStampToSeconds($datum);
2023-01-12 16:18:15 +01:00
2023-01-16 16:13:45 +01:00
}
2023-01-12 16:18:15 +01:00
}
function convertTimeStampToSeconds($timestamp)
{
2023-02-16 14:49:46 +01:00
// if (!$timestamp) {
// return ' '
// }
2023-01-12 16:18:15 +01:00
$converted = '';
$boom = explode(':', $timestamp);
$seconds = explode('.', $boom[2]);
$converted = $boom[0] * 120 + $boom[1] * 60 + $boom[2] * 1;
return $converted;
}
2023-02-16 14:49:46 +01:00
echo "\n";
2023-01-12 16:18:15 +01:00
foreach ($results as $result) {
2023-02-16 14:49:46 +01:00
echo round($result) . "\n";
2023-01-12 16:18:15 +01:00
}