clock

Clock on webpage using server and system time?

痴心易碎 提交于 2019-11-30 12:01:56
I need to add a clock to a web page. The clock needs to be synchronized with a server but I really don't want to have it constantly check the server as the page will be open 24/7 on several PCs. Is there some way to get the time from the server and then use the systems clock to keep it updated and check the server every 15 minutes or so to keep it synced? The way I've gone about this before is: Take the time from the server, Take the time from the client (immediately) Get an offset. When showing the clock, apply the offset to the current time on the client. You only need to update this

Set time with custom android AnalogClock from its original class

怎甘沉沦 提交于 2019-11-30 10:39:29
I want to make a custom AnalogClock class using source code of AnalogClock by Android Open Source Project that is available in the internet. I want to make the clock set the time that I want, not the current time. I didn't find a clear example on how to do it so maybe this post will be useful. After copying source code to new file, I get some errors. Below is the original source code of AnalogClock: /* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You

How can I implement Apple's “Snooze” functionality in their Clock app?

隐身守侯 提交于 2019-11-30 10:17:43
I'm diving into iOS development and am building my own alarm clock app to become familiar with the platform and SDK. One of the API's I'm currently learning is the Local Notifications API, which I assume is the same API Apple uses to implement their alarms in their Clock app. What I don't understand is how they implement their "Snooze" functionality. As I understand it, Local Notifications allow you to present to the user an alert box that has at most two buttons when your app isn't running in the foreground, one button for dismissing the alert and one button for taking the user to your app.

How to check HZ in the terminal?

萝らか妹 提交于 2019-11-30 08:32:17
I have seen this http://kaasxxx.wordpress.com/2008/01/22/linux-hz-checker/ But the script seems not to work. Does anyway know an easy way to check "HZ" in the terminal in Linux? There's no uniform answer to this questions, as in some cases your kernel may be compiled "tickless" and not use a regular timer interrupt at all. But if you're on a traditional kernel and a traditional distro, you can find the current kernel's .config file under /boot with something like grep 'CONFIG_HZ=' /boot/config-$(uname -r) . The value of HZ can be determined like so: $ getconf CLK_TCK 100 Any of the compile

How to set Alarm using alarm clock class

时间秒杀一切 提交于 2019-11-30 07:14:01
Hi I am trying to set Alarm in my application Using the AlarmClock class. I am using the code as follows: Intent intent = new Intent(); intent.setAction(AlarmClock.ACTION_SET_ALARM); startActivity(intent); But I am getting an exception. Can anyone please tell how to use this new Android feature? You'll also need to add <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/> to your manifest. Ollie is right, the code should look something like the following: Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); i.putExtra(AlarmClock.EXTRA_HOUR, 9); i.putExtra(AlarmClock.EXTRA

Can I prevent an iOS user from changing the date and time?

让人想犯罪 __ 提交于 2019-11-30 05:03:31
I want to deploy managed iOS devices to employees of the company, and the app they will use will timestamp data that will be recorded locally, then forwarded. I need those timestamps to be correct, so I must prevent the user from adjusting the time on the device, recording a value, then resetting the date and time. Date and time will be configured to come from the network automatically, but the device may not have network connectivity at all times (otherwise I would just read network time every time a data value is recorded). I haven't seen an option in Apple Configurator to prevent changing

Clock drift on Windows

随声附和 提交于 2019-11-30 03:35:28
I've developed a Windows service which tracks business events. It uses the Windows clock to timestamp events. However, the underlying clock can drift quite dramatically (e.g. losing a few seconds per minute), particularly when the CPUs are working hard. Our servers use the Windows Time Service to stay in sync with domain controllers, which uses NTP under the hood, but the sync frequency is controlled by domain policy, and in any case even syncing every minute would still allow significant drift. Are there any techniques we can use to keep the clock more stable, other than using hardware clocks

javascript countdown clock

三世轮回 提交于 2019-11-30 00:00:59
问题 <script> var interval; var minutes = 1; var seconds = 5; window.onload = function() { countdown('countdown'); } function countdown(element) { interval = setInterval(function() { var el = document.getElementById(element); if(seconds == 0) { if(minutes == 0) { el.innerHTML = "countdown's over!"; clearInterval(interval); return; } else { minutes--; seconds = 60; } } if(minutes > 0) { var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute'); } else { var minute_text = ''; } var second

How can I measure time in Java not susceptible to System clock changes?

限于喜欢 提交于 2019-11-29 22:52:09
问题 I would like to measure elapsed time in a Java. However differences in System.currentTimeMillis() and (I believe) System.nanoTime() can be changed by external changes eg someone (or the system) altering the system clock. Using network calls is not an option as it's possible very frequent and fast returns are required. Is there a common solution for this? EDIT Sorry, I should have elaborated about the reason. It isn't to stop malicious users - it's things like client initiated logout for being

How to sync time on host wake-up within VirtualBox?

怎甘沉沦 提交于 2019-11-29 20:24:24
I am running an Ubuntu 12.04-based box inside of Vagrant using VirtualBox. So far, everything is fine - except for one thing: Let's assume that the VM is running. Then, the host goes to standby-mode. After waking it up again, the VM is still running, but its internal clock continues where it stopped when the host went down. So this basically means: Put the host to sleep for 15 minutes, wake it up again, then the VM's internal clock is 15 minutes late. How can I fix this (setting the time manually is not an option for obvious reasons ;-))? Is there a way to run a script inside of a Vagrant VM