blob: a41358ca5b82422b3f74b01de229d050e6da69f6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004 - 2006 University Of British Columbia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.sandbox.misc;
/**
* Check against the system clock--doesn't need to run as thread.
*
* @author Mik Kersten
*/
public class PassiveTimer {
private long elapsed = 0;
private long lastStartTime = System.currentTimeMillis();
public void restart() {
lastStartTime = System.currentTimeMillis();
elapsed = 0;
}
public long getElapsedInSeconds() {
elapsed = System.currentTimeMillis() - lastStartTime;
return elapsed / 1000;
}
}