This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.emil.android.util; | |
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.telephony.TelephonyManager; | |
/** | |
* Check device's network connectivity and speed | |
* @author emil http://stackoverflow.com/users/220710/emil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var time = new Date().getTime(); | |
var interval = 1000; | |
(function update() { | |
requestAnimationFrame(update); | |
var now = new Date().getTime(), | |
delta = now - (time || now); | |
if(delta>=interval) { | |
// Update a "time ago"|"time left" or do something... | |
console.log((new Date(now)).getSeconds()); |
NewerOlder