WIN10 's new alarm clock application includes alarm clock, stopwatch, timer, world time four time settings related to the small software, we introduced the alarm clock and the use of stopwatch. So how do you use timers?
Turn on the countdown.
How to Set
We can use the mouse to move the end of the circle button to set our time.
Set up, we can directly click on the middle of the "Start" button, s
Several groups of data must be refreshed regularly on one of the pages of a project over the past few days. However, each set of data must be refreshed at different times, so multiple timers are required. I have just been working for a while and do not know much about JS Ajax. Instead, I know a little about Microsoft's Ajax. However, when I found that multiple ti
the timer run time remaining, there is a timer interrupt will call the interrupt function, resources so, we also have to pass the software to the virtual timer. The hardware timer has the relevant timing register resources to set timing time and some configuration parameters, software to simulate also need timing time and configuration parameters to describe this timer, here we use a structure to save these parameter data, its members include: Timer state (idle, active, in use, timeout trigger,
. The third parameter is generally null in this method.
Note: When you set the second parameter, be aware that if you set a wait time that is shorter than the processing time, the program will go wrong.
1.2 Calling the callback function
This method first writes a callback function in the following format
void CALLBACK TimerProc(HWND hWnd,UINT nMsg,UINT nTimerid,DWORD dwTime);
Then use the SetTimer (1,100,TIMERPROC) function to build a timer, and the third parameter is the callback function
Single thread multi-timer The company's business needs, the example of a large number of needs to start the operation of the timer; everyone knows that the timer in Python is threading. Timer, each time a timer is started, the program inside a thread, the timer trigger execution end, the thread automatically destroyed; Here is a problem, if there is a large number of start timer requirements, the internal thread too much, the program must be collapsed, there is no starting a thread can complete
This article mainly uses examples to explain how multiple js countdown tasks can be performed at the same time. If you are interested, you can refer to the example in this article to explain how js countdown works at the same time, the content is as follows:
:
Function: Call a function to input the id of the html element and the end time (unix timestamp) to pri
I found a lot of js countdown codes on the Internet, but they can only be used once on the same page. I finally saw a page from a friend's blog that can call the countdown js Code multiple times. I will share it with you.
Today, we need to implement multiple countdown functi
JQuery CountDown (CountDown)
It can be used for multiple countdown times on a single page and is convenient to call.
/*
jquery.countdown.js
*/
(function($){
var countdown = function(item, config)
{
var seconds = parseInt($(item).attr(config.
;width:40px;Height:20px;text-align:Center;Line-height:20px;Display:Inline-block;}varendtime,nowtime,lefttime,d,h,m,s;varSh;$.fn.countdown=function(_boolean,_this) {varSH = []; //var _this = $ (this);_this.each (function(Index, EL) {varThisobj = $ ( This); Sh[index]=setinterval (function(){ varTimes = Thisobj.data ("Times");//gets the data value of the Timebox, which is the end timeEndtime =NewDate (times);//Convert data value to timeNowtime =NewDate ();//Get current TimeLefttime=parseint
run () {if (Mtickerstoppe d) Return;long currenttime = System.currenttimemillis (); if (currenttime/1000 = = Endtime/1000-1 * 60) {//Determines whether the specified time m Clocklistener.remainoneminutes (); The Callback}long distancetime = endtime-currenttime;//of the specified time calculates the difference distancetime/= 1000; Convert to seconds if (Distancetime = = 0) {setText ("00:00:00"); Ondetachedfromwindow ();// Ensure that the runnable is not continuously running. Mclocklistener.timee
The countdown JS for multiple products on the same page is implemented based on object-oriented javascript code. For more information, see
The Code is as follows:
doesn't go to 11 o'clock, it shows the first order.Pos=0; }Else if(pos>=9) {//if it's over 20, it's completely reversed.Pos=9} s= ' Active ' + p[pos]+ ' in progress '; Console.log (s); //reverse-Sort the property based on the time in the arrayP.reverse (Compare ("Time")); Console.log (POS); Console.log (P); //define a temporary array to store obsolete itemsTMP = [] for(i = 0; i) {Tmp.push (P.pop ()); } //Reorder the remaining re-phasesP.re
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.