List of usage examples for java.util Calendar getTimeInMillis
public long getTimeInMillis()
From source file:com.prey.json.actions.Report.java
public boolean valida(Context ctx) { long lastReportStartDate = PreyConfig.getPreyConfig(ctx).getLastReportStartDate(); PreyLogger.d("last:" + lastReportStartDate); if (lastReportStartDate != 0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(lastReportStartDate); cal.add(Calendar.MINUTE, 1); long timeMore = cal.getTimeInMillis(); PreyLogger.d("timM:" + timeMore); Date nowDate = new Date(); long now = nowDate.getTime(); PreyLogger.d("now_:" + now); PreyLogger.d("now>=timeMore:" + (now >= timeMore)); return (now >= timeMore); }/* www . ja va2 s. c o m*/ return true; }
From source file:com.joe.utilities.core.hibernate.repository.impl.ApplicationConfigurationRepositoryImpl.java
public Long retrieveDBTimeOffsetInMilliseconds() { DbTimestampType type = new DbTimestampType(); Timestamp ts = (Timestamp) type.seed((SessionImplementor) getSession()); Calendar cal = Calendar.getInstance(); long actualTimeDiff = cal.getTimeInMillis() - ts.getTime(); //System.out.println("Actual Time Diff in ms(AS - DB)="+actualTimeDiff); return new Long(actualTimeDiff); }
From source file:org.wso2.appserver.integration.tests.webapp.virtualhost.VitualHostWebApplicationDeploymentTestCase.java
private GetMethod invokeWebapp() throws IOException { String webappUrl = webAppURL + "/" + webAppName + "/"; HttpClient client = new HttpClient(); GetMethod getRequest = new GetMethod(webappUrl); //set Host tag value of request header to $vhostName //(This avoids the requirement to add an entry to etc/hosts/ to pass this test case) getRequest.getParams().setVirtualHost(vhostName); Calendar startTime = Calendar.getInstance(); while ((Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis()) < GET_RESPONSE_DELAY) { client.executeMethod(getRequest); if (!getRequest.getResponseBodyAsString().isEmpty()) { return getRequest; }/* w ww .jav a 2 s. c o m*/ } return getRequest; }
From source file:com.joinsystem.goku.common.utils.DateUtil.java
/** * /*from w ww .java2 s . c o m*/ * @param beginDate * @param endDate ? * @return */ public static int daysBetween(String beginDate, String endDate) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); Calendar cal2 = Calendar.getInstance(); try { cal.setTime(sdf.parse(beginDate)); cal2.setTime(sdf.parse(endDate)); long time1 = cal.getTimeInMillis(); long time2 = cal2.getTimeInMillis(); long between_days = (time2 - time1) / (1000 * 3600 * 24); return (int) between_days; } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 1; }
From source file:org.kuali.mobility.push.dao.PushDeviceTupleDaoImplTest.java
@Test @DirtiesContext//w ww .ja v a 2 s . com public void testUpdateTuple() { List<PushDeviceTuple> tuples = getDao().findUnsentTuples(); PushDeviceTuple tuple = tuples.get(2); Calendar cal = Calendar.getInstance(); tuple.setPostedTimestamp(new Timestamp(cal.getTimeInMillis())); Long oldId = tuple.getId(); Long newId = getDao().saveTuple(tuple); assertTrue("Tuple was inserted, not updated.", oldId.compareTo(newId) == 0); }
From source file:eu.planets_project.tb.gui.backing.exp.MeasurementPropertyResultsBean.java
/** * This prevents the hm of returning null for a RecordBean * @param allRunDates// w w w . ja v a2 s . c o m */ private void initResultsHM(List<Calendar> allRunDates) { if (this.results != null && allRunDates != null) { for (Calendar runDate : allRunDates) { if (runDate != null) { this.results.put(runDate.getTimeInMillis(), new RecordBean()); } } } }
From source file:org.kuali.mobility.push.dao.PushDeviceTupleDaoImplTest.java
@Test @DirtiesContext/* w ww .j a v a 2 s.c o m*/ public void testSaveTuple() { PushDeviceTuple tuple = new PushDeviceTuple(); tuple.setDeviceId(new Long(3)); tuple.setPushId(new Long(6)); Calendar cal = Calendar.getInstance(); tuple.setPostedTimestamp(new Timestamp(cal.getTimeInMillis())); tuple.setStatus(0); Long id = getDao().saveTuple(tuple); LOG.debug("========== Saved tuple with id " + id + " ========="); assertNotNull("Tuple failed to save.", id); }
From source file:com.bt.sdk.callcontrol.demo.standup.ConferenceRowCallbackHandler.java
private long secondsBeforeStartTime(Calendar conferenceTime) { Calendar now = Calendar.getInstance(); return (conferenceTime.getTimeInMillis() - now.getTimeInMillis()) / 1000; }
From source file:eu.planets_project.tb.impl.model.PropertyEvaluationRecordImpl.java
/** * Contains the evaluation information for this property broken down by the execution dates * @param runDate//w w w .ja v a 2 s . com * @param propRunEvalRec */ public void addPropertyRunEvalRecord(Calendar runDate, PropertyRunEvaluationRecordImpl propRunEvalRec) { if (propertyRunEvalRecords != null) { this.propertyRunEvalRecords.put(runDate.getTimeInMillis(), propRunEvalRec); } }
From source file:org.kuali.mobility.socialmedia.service.TwitterServiceImpl.java
private TwitterFeed retrieveFeed(String publicId) { TwitterFeed feed = twitterFeeds.get(publicId); if (feed == null) { feed = new TwitterFeed(); feed.setTwitterId(publicId);/* w w w . j a v a2s. co m*/ TwitterFeed existing = twitterFeeds.putIfAbsent(publicId, feed); if (existing == null) { updateFeed(feed); } else { feed = existing; } } Calendar now = Calendar.getInstance(); if (now.getTimeInMillis() - feed.getLastUpdated() > FEED_UPDATE_INTERVAL) { updateFeed(feed); } return feed; }