/*
    第2種情報処理技術者試験    平成5年度・秋期・午後 問8 設問1
                                BohYoh Shibata PREPARATION
*/

#include <stdio.h>

#define HOUR      3600L
#define MINUTE    60L


void elapse(char *, char *, char *);
long dectime(char *);

void elapse(char *start, char *end, char *diff)
{
    long  dtime, hh, mm, ss;

    dtime = dectime(end) - dectime(start);
    if (dtime < 0L)
        dtime += 24L * HOUR;
    hh = dtime / HOUR;
    mm = dtime % HOUR / MINUTE;
    ss = dtime % MINUTE;
    sprintf(diff, "%02ld:%02ld:%02ld", hh, mm, ss);
}

long dectime(char *strtime)
{
    long  hh, mm, ss;

    sscanf(strtime, "%ld:%ld:%ld",  &hh, &mm, &ss);
    return (hh * HOUR + mm * MINUTE + ss);
}