PreviousUpNext

15.4.97  src/app/makelib/paths/timestamp.pkg

## makelib timestamp semantics.

# Compiled by:
#     src/app/makelib/paths/srcpath.sublib



##                             "Programs must be written for people
##                              to read, and only incidentally for
##                              machines to execute."
##
##                                      -- Abelson and Sussman



package   timestamp   {
    #     =========
    #
    Timestamp
        = NO_TIMESTAMP
        | TIMESTAMP  time::Time                                                         # time  is from   src/lib/std/time.pkg
        ;

    ancient =  TIMESTAMP (time::zero_time);



    # We consider a target good if it has the same time stamp
    # as the source.  A target that isn't there is never good,
    # and if there is a target but no source, then we assume the
    # target to be ok.
    #
    fun needs_update { target => NO_TIMESTAMP, ... } =>  TRUE;
        needs_update { source => NO_TIMESTAMP, ... } =>  FALSE;

        needs_update { source => TIMESTAMP st,
                       target => TIMESTAMP tt
                     }
            =>
            time::compare (st, tt)  !=  EQUAL;
    end;


    fun last_file_modification_time filename
        =
        TIMESTAMP (winix__premicrothread::file::last_file_modification_time  filename)
        except
            _ = NO_TIMESTAMP;

                                                                                        # winix__premicrothread is from   src/lib/std/winix--premicrothread.pkg

    fun set_last_file_modification_time (filename, NO_TIMESTAMP)
            =>
            ();

        set_last_file_modification_time (filename, TIMESTAMP timestamp)
            =>
            winix__premicrothread::file::set_last_file_modification_time (filename, THE timestamp);
    end;


    fun max (TIMESTAMP t, TIMESTAMP t')
            =>
            TIMESTAMP  if  (time::(<) (t, t')  )  t';
                                              else  t;   fi;

        max _
            =>
            NO_TIMESTAMP;
    end;


    fun to_string NO_TIMESTAMP          =>  "none";
        to_string (TIMESTAMP timestamp) =>  time::to_string timestamp;
    end;

};


## (C) 1999 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext