Skip to content

Instantly share code, notes, and snippets.

kyriakos

Block or report user

Report or block kyriakos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kyriakos
kyriakos / posix2seconds.php
Created Sep 2, 2016
Convert ps etime to seconds in PHP - [[dd-]hh:]mm:ss
View posix2seconds.php
/* coverts process durations output from the ps linux command in the [[dd-]hh:]mm:ss format to seconds
* useful when you need to find long running processes in PHP
*/
function posixTimeToSeconds($str) {
$parts = explode(':', $str);
$c = count($parts);
if ($c == 2) {
return (int)$parts[0] * 60 + (int)$parts[1];
} else if ($c == 3) {
You can’t perform that action at this time.