/** * Returns the time value associated to this <tt>Date</tt> * * @return the time value associated to this <tt>Date</tt> */ public double valueOf() { return getTime(); } }
public static String toNormalizedString(Date d) { // TODO - improve perf here return new SimpleDateFormat(DEFAULT_DATE_PATTERN).format(new java.util.Date((long) d.getTime())); }
/** * Updates the ID timestamp of the object, for versioning purposes. * * @method updateTimestamp */ public void updateTimestamp() { String rawId = id.substring(0, id.lastIndexOf("/")); if (rawId.endsWith("/") == false) rawId += "/"; rawId += new Date().getTime(); id = rawId; }
/** * Computes the date from the given arguments interpreting them as UTC and * returns the corresponding time value. * * <p>The <tt>UTC</tt> function differs from the <tt>Date</tt> constructor * in two ways: it returns a time value as a <tt>Number</tt>, rather than * creating a <tt>Date</tt> object, and it interprets the arguments in UTC * rather than as local time. * * @param year the year (in UTC time zone) * @param month the month of the year (in UTC time zone) * @param day the day of the month (in UTC time zone) * @param hours the hour of the day (in UTC time zone) * @param minutes the minute of the hour (in UTC time zone) * @param seconds the second of the minute (in UTC time zone) * @param ms the milliseconds of the second (in UTC time zone) * @return the UTC time value corresponding to the given arguments */ public static double UTC(int year, int month, int day, int hours, int minutes, int seconds, int ms) { return new Date(year, month, day, hours, minutes, seconds, ms).getTime(); }
@Override public void $invoke(Long expirationDate) { //null expiration date or expired assertion if (expirationDate == null || expirationDate <= (long) new Date().getTime()) { cgb.assertionsFilledIn++; cgb.checkAssertionDetailsFetched(); } else { sa.setExpirationDate(expirationDate); cgb.fetchAssertionDetailsNegativeStatus(a, sa); } } },
/** * Returns the time value designating the UTC date and time of at the * moment <tt>now</tt> is called. * * @return the time value designating the UTC date and time of at the moment <tt>now</tt> is called. */ @BrowserCompatibility("IE:9+") public static double now(){ return new Date().getTime(); }
@Override public void $invoke(Long assertionDate) { //null assertion date or future assertion if (assertionDate == null || assertionDate > (long) new Date().getTime()) { cgb.assertionsFilledIn++; cgb.checkAssertionDetailsFetched(); } else { sa.setAssertionDate(assertionDate); cgb.fetchAssertionDetailsExpirationDate(a, sa); } } },
protected void log(Object string) { if (logFunction != null) logFunction.$invoke("" + new Date().getTime() % 100000 + ": " + string); }
/** * Will generate an identifier using the server URL provided (usually from * an EcRepository). * * @param {string} server Base URL of the server's repository functionality. * @method generateId */ public void generateId(String server) { id = server; if (!id.endsWith("/") && !id.endsWith("ce-")) id += "/"; id += "data/"; id += getDottedType(); id += "/"; id += EcRandom.generateUUID(); id += "/"; id += new Date().getTime(); }
/** * Will generate an identifier using the server URL provided (usually from * an EcRepository) and unique identifier. * * @param {string} server Base URL of the server's repository functionality. * @param {string} uniqueIdentifier Canonical identifier. Must contain a letter or symbol. * @method assignId */ public void assignId(String server, String uniqueIdentifier) { id = server; if (!id.endsWith("/")) id += "/"; id += "data/"; //endpoint to CRUD data id += getDottedType(); //type information (ease of use) id += "/"; id += uniqueIdentifier; //local identifier id += "/"; id += new Date().getTime(); //version }
return new Date(date).getTime();
@Override public void $invoke(Object p1) { if (p1 != null) { if (JSObjectAdapter.$get(p1, "ping") == "pong") { if (JSObjectAdapter.$get(p1, "time") != null) me.timeOffset = ((Long)(Object)new Date().getTime())-((Long)(Object)JSObjectAdapter.$get(p1, "time")); me.selectedServer = guess; me.autoDetectFound = true; } } } };
private void processInputParameters(CompetencyGraph inputGraph, String subjectPem, Long predictionDate, PapDependencyDefinitions dependencyDefs, PapSettings settings) { this.dependencyDefs = dependencyDefs; verifyDependencyDefs(); this.settings = settings; if (this.settings == null) this.settings = new PapSettings(); this.inputGraph = inputGraph; this.subjectPem = subjectPem; if (this.subjectPem != null) this.subjectPem = this.subjectPem.trim(); this.predictionDate = predictionDate; if (this.predictionDate == null) this.predictionDate = (long)(new Date()).getTime(); stepSize = STEP_SIZE_NUMERATOR /this.settings.getIterations(); priorityQueueThreshold = this.settings.getPriorityQueueThreshold()/this.settings.getIterations(); }
public void log(InquiryPacket ip, Object string) { if (logFunction != null) { String id = ""; if (ip.competency != null && ip.competency.$length() > 0) id = ip.competency.$get(0).shortId() + ":"; logFunction.$invoke(new Date().getTime() % 100000 + ": " + string); } ip.log += "\n" + string; }
@Override public void $invoke(Object p1) { if (p1 != null) { if (JSObjectAdapter.$get(p1, "ping") == "pong") { if (JSObjectAdapter.$get(p1, "time") != null) me.timeOffset = ((Long)(Object)new Date().getTime())-((Long)(Object)JSObjectAdapter.$get(p1, "time")); if (me.autoDetectFound == false) { me.selectedServer = guess; me.autoDetectFound = true; success.$invoke(); } } } } };
@Override public void $invoke(Array<EcIdentity> pks) { Array cache = null; String stringified = JSGlobal.JSON.stringify(signatures); if (signatureSheetCaching) { cache = new Array(); cache.$set(0, new Date().getTime() + finalDuration); cache.$set(1, stringified); JSObjectAdapter.$put(signatureSheetCache, server, cache); } success.$invoke(stringified); } });
/** * Asynchronously create a signature for a specific identity * * @param {long} duration Length of time in milliseconds to authorize * control. * @param {String} server Server that we are authorizing. * @param {EcPpk} ppk Key of the identity to create a signature for * @param success Callback triggered once the signature sheet has been * created, returns the signature * @memberOf EcIdentityManager * @method createSignatureAsync * @static */ private static void createSignatureAsync(long duration, String server, EcPpk ppk, final Callback1<EbacSignature> success, final Callback1<String> failure) { final EbacSignature s = new EbacSignature(); s.owner = ppk.toPk().toPem(); s.expiry = new Date().getTime() + duration; s.server = server; EcRsaOaepAsync.sign(ppk, s.toJson(), new Callback1<String>() { @Override public void $invoke(String p1) { s.signature = p1; success.$invoke(s); } }, failure); }
/** * Create a signature for a specific identity, authorizing movement of data * outside of our control. * * @param {long} duration Length of time in milliseconds to authorize * control. * @param {String} server Server that we are authorizing. * @param {EcPpk} ppk Key of the identity to create a signature for * @return {Ebac Signature} Signature created * @memberOf EcIdentityManager * @method createSignature * @static */ public static EbacSignature createSignature(long duration, String server, EcPpk ppk) { EbacSignature s = new EbacSignature(); s.owner = ppk.toPk().toPem(); s.expiry = new Date().getTime() + duration; s.server = server; s.signature = EcRsaOaep.sign(ppk, s.toJson()); return s; }
cache = (Array) JSObjectAdapter.$get(signatureSheetCache, server); if (cache != null) { if ((Long) cache.$get(0) > new Date().getTime() + duration) { return (String) cache.$get(1); if (signatureSheetCaching) { cache = new Array(); cache.$set(0, new Date().getTime() + duration); cache.$set(1, stringified); JSObjectAdapter.$put(signatureSheetCache, server, cache);
equivalentPackets = new Array<InquiryPacket>(); subPackets = new Array<InquiryPacket>(); dateCreated = new Date().getTime(); this.subject = subject; this.competency = new Array<>();