java - Time stamp with milliseconds, calculating "delay" -


when create instance of object, say, message m want set field in it, time stamp.

nothing databases.

when object passed around have time stamp read , compared current time of recipient calculate delay = timenow - m.sent_at. both objects exist on same system , both entities use system's clock (actual time, nothing fancy, delay important), want in milliseconds.

something this:

class message {     public final long sentat;      public final string data;      public message(string data) {         this.sentat = system.currenttimemillis()         this.data = data;     }      public long timesincesent() {         return system.currenttimemillis() - sentat;     } } 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -