/** * @return the change counter of this event. * Computed from the current time, and will increase every * ten seconds. * @see ERCalendarEvent#sequence() */ public int sequence() { return (int)(new NSTimestamp().getTime() / 10000); }
public long timestamp() { return lastModified().getTime(); }
public double doubleForValue(Object v) { double scr = 0.0; if(v == null) { return 0.0; } else if (v instanceof String) { try { scr = Double.parseDouble((String)v); } catch(NumberFormatException e) { log.error("Not a number: {}", v); scr = 0.0; } } else if(v instanceof Number){ Number vv = (Number)v; scr = vv.doubleValue(); } else if (v instanceof NSTimestamp) { NSTimestamp vv = (NSTimestamp)v; scr = vv.getTime() / 1000.0; } else if(v == NSKeyValueCoding.NullValue) { scr = 0.0; } else { try { scr = Double.parseDouble(v.toString()); } catch(NumberFormatException ex) { log.error("Not a number: {}", v); scr = 0.0; } } return scr; }
public String runningTime() { long aRunningTime = System.currentTimeMillis()-((NSTimestamp)statsDict.objectForKey("StartedAt")).getTime(); String aRunningTimeString = WOStatsPage._timeIntervalDescription(aRunningTime); return aRunningTimeString; }
public Object marshall(SerializerState state, Object p, Object o) throws MarshallException { try { long time; String tz; if (o instanceof NSTimestamp) { time = ((NSTimestamp) o).getTime(); tz = ((NSTimestamp) o).timeZone().getID(); } else { throw new MarshallException("cannot marshall date using class " + o.getClass()); } JSONObject obj = new JSONObject(); if (ser.getMarshallClassHints()) { obj.put("javaClass", o.getClass().getName()); } obj.put("time", time); obj.put("tz", tz); return obj; } catch (JSONException e) { throw new MarshallException("Failed to marshall NSTimestamp.", e); } }
public void willAttemptToStart() { state = MObject.STARTING; long timeForStartup; Integer tfs = _application.timeForStartup(); if (tfs != null) { timeForStartup = tfs.intValue(); } else { timeForStartup = MInstance.TIME_FOR_STARTUP; } _finishStartingByDate = new NSTimestamp(new NSTimestamp().getTime() + (timeForStartup * 1000)); }
aRunningTime = (aDate.getTime() - System.currentTimeMillis()) / 1000; } catch (java.text.ParseException ex) { aRunningTime = (float) 0.0;
String currentDate = currentTime.toString(); long cutOffTime = _lastRegistration.getTime() + lifebeatCheckInterval(); String assumedToBeDead = ""; if (currentTime.getTime() > cutOffTime) { long secondsDifference = (currentTime.getTime() - _lastRegistration.getTime()) / 1000; assumedToBeDead = "The app did not respond for " + secondsDifference + " seconds " + "which is greater than the allowed threshold of " + lifebeatCheckInterval() + " seconds " +