/* Manipulations sur une classe temps         */

public class ManipulationTempsEnConsole {

/* Type agrege de stockage des informations   */
/* relatives a un temps code sous la forme    */
/* heure, minute, seconde                     */

  static class Temps {
    int h = 0;
    int mn = 0;
    int s = 0; };

/* Programme principal                        */

  public static void main(String [] args) {
    Console.setTitle("ManipulationTemps");
    Temps t1 = new Temps();
    Temps t2 = new Temps();
    boolean inferieurEgalT1T2;
    int difference;
    int s1;
    int s2;
    Console.afficherln("SVP, t1 (h, mn & s)?");
    t1.h = Console.saisirInt();
    t1.mn = Console.saisirInt();
    t1.s = Console.saisirInt();
    Console.afficherln("SVP, t2 (h, mn & s)?");
    t2.h = Console.saisirInt();
    t2.mn = Console.saisirInt();
    t2.s = Console.saisirInt();
    s1 = 3600*t1.h+60*t1.mn+t1.s;
    s2 = 3600*t2.h+60*t2.mn+t2.s;
    inferieurEgalT1T2 = (s1 <= s2);
    if ( inferieurEgalT1T2 ) {
      difference = s2-s1;
      Console.afficherln("[",t2.h,":",t2.mn,":",t2.s,"]");
      Console.afficherln("[",t1.h,":",t1.mn,":",t1.s,"]"); }
      else {
      difference = s1-s2;
      Console.afficherln("[",t1.h,":",t1.mn,":",t1.s,"]");
      Console.afficherln("[",t2.h,":",t2.mn,":",t2.s,"]"); }
    Console.afficherln("Ecart : ",s2-s1," secondes");
  }
}