Click here to Skip to main content
15,893,190 members
Everything / Time

Time

time

Great Reads

by Graham Wilson
An exercise to measure the drift in the time-of-day clock on a Windows PC using the periodic timer
by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code
by Keith Barrow
If you have a Winforms application that auto loads data, there is no doubt that you’ll have come across the problem of data loading at design time (i.e. when opening the code in the designer). At best, this slows the designer down, at worst it might crash VS and prevent the control from...
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.

Latest Articles

by honey the codewitch
Just a clock with snazzy digits that syncs using NTP and gets your timezone from your IP.
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.
by honey the codewitch
Create a clock that uses multiple Internet services to detect your weather, date and time
by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code

All Articles

Sort by Updated

Time 

19 Mar 2024 by honey the codewitch
Just a clock with snazzy digits that syncs using NTP and gets your timezone from your IP.
17 Jan 2024 by Mickey P
Big O notation talks about generalizations. its similar to if you were doing size estimates in lets say economics: such that 1000 and 750 would be both rounded to 1000 and what is interesting is 10K is not in the same ballpark of 100K but 13K is...
4 Feb 2023 by Christian Torrico
Hi,i wanted to ask if there was some way to get the server date from a Microsoft Access database.I know about Date() and Time() methods, but in SELECT they give me local time. Can you give some help with this?
4 Feb 2023 by Member 15914427
If it is a local server you can, try this procedure Private Sub btnServidorLocal_Click() ' Reference Windows Script Host Object Model Dim cmdShell As New WshShell Dim cmdEjecute As WshExec Dim cmdInstruccion, hora, dia, tem As String ...
30 Dec 2022 by Graeme_Grant
You could write a windows service[^] that stores the date & time every minute in a specific file. Then your reporting app can use that information. UPDATE Maybe you are looking for Logged in/out session information. This may help: How to get...
30 Dec 2022 by DoingWork
I am reading LastBootUpTime by following method but it displays few days old time while I shutdown my PC on daily basis. I know the solution described in this link Windows 10 LastBootUpTime not updating[^] but enforce each user to change system...
30 Dec 2022 by OriginalGriff
The last boot time is probably correct - it's just your idea of what you do with your computer that differs from Windows. With Win 10 / 11 (and maybe earlier, I'm not sure) "shutdown" and "restart" don't do what the name implies, not really -...
29 Dec 2022 by stackprogramer
When I set the time and date of my Linux to old, In browsing some HTTPS site it can not open the website, my question is: Is there any extension that neutralizes the error clock is behind error? Or any software for linux that can set timezone...
29 Dec 2022 by Rui Oliveira Pinheiro
That is not the only common reason. Another reason is to access a site that in most browsers is blocked due to HSTS restrictions just because the certificate expired. The browsers are a bit too stupid and do not offer the traditional bypassing...
14 Dec 2022 by K67987
This is some of the formattedResults (there are 60 results) { "statusCode": "200", "time": "2022-12-07 10:24:00.000", "count": "3" } This is part of the code, seems to be an issue with the last line of code. let labels = {} let...
14 Dec 2022 by Richard Deeming
Quote: [...Array(61).keys()].map(i => 0) That seems like a horribly inefficient method to produce a 61-element array of zeros. You create a new array, iterate over its keys, create a new array from that, then create a third array mapping each...
24 Aug 2022 by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.
16 Jun 2022 by honey the codewitch
Create a clock that uses multiple Internet services to detect your weather, date and time
15 Jun 2022 by Emon Ahmed
Task: Add 15 minutes and 20 minutes patterns to a given time. [08:00:00] Increment the time by 20 minutes, plus add every quarter hour to it. What I have tried: let x = new Date('2100-01-05T08:00:00') let y = new...
15 Jun 2022 by ludosoep
Both the 15 and 20 minute intervals are dividable by five minutes. Declare a variable outside of the for loop and keep adding five minutes every iteration, test if the minutes are dividable by 15 or 20 and, if true, push them to expected time. ...
11 Jun 2022 by honey the codewitch
Create a simple synchronized analog clock using GFX, and a bit of code
21 May 2022 by OriginalGriff
The simple solution is: set your system clock to the current time and let the OS keep it accurate via an internet time server. The only common reason for changing the date and / or time is to fool software licences into thinking they are still...
11 Apr 2022 by Luc Pattyn
the big O notation only tells you how the execution time will change when the "size" of the problem is changed, it does not provide an actual estimate for a specific case. In other words, there is an unknown factor, so for example O(n2) could...
11 Apr 2022 by Hoang Minh Quang FX15045
I'm learning a Coursera course about time complexity. I encounter this in a video and I think something is wrong. "So suppose that we have an algorithm whose runtime is roughly proportional to n and we want it to run it on a machine that runs at...
11 Apr 2022 by Greg Utas
30 seconds is about right if it's log2(n). log2(1000) ~= 10. EDIT: O(n log(n)) algorithms often recursively divide the problem in half, solve each part separately, and then combine the solutions. This is why log2 is usually implied. Mergesort is...
11 Apr 2022 by OriginalGriff
To add to what the others say, you can't equate clock cycles directly with execution time anyway - some machine operations take n cycles to execute, others may be n * 2. To add to that, modern processors are pipelined - so some instructions may...
11 Apr 2022 by Patrice T
Quote: If the input size n is 10^9, then it should take 10^9 * log(10^9) / 10^9 = 9 second, right? No ! You don't calculate runtime from Big O notation, at least not by itself. The Big O notation tells you the category complexity of an...
11 Apr 2022 by CPallini
The big O doesn't give the exact time of execution. See, for instance Big O notation - Wikipedia[^] (Properties sections, multiplication by a constant).
9 Apr 2022 by Hoang Minh Quang FX15045
I'm learning about the time complexity of algorithms. As far as I know, the compile-time will take longer the larger the input (larger in this situation means more input). But I wonder, is the input number itself matter? For example, I have a...
9 Apr 2022 by Patrice T
Quote: As far as I know, the compile-time will take longer the larger the input (larger in this situation means more input). Compile time is no linked with larger input, but runtime is linked to size of input. Quote: But I wonder, is the input...
9 Apr 2022 by OriginalGriff
Quote: I'm learning about the time complexity of algorithms. As far as I know, the compile-time will take longer the larger the input (larger in this situation means more input). But I wonder, is the input number itself matter? No. Compilation...
9 Apr 2022 by Richard MacCutchan
If the numbers are constant values in your source code then compile time may be a few attoseconds longer. If they are input to the program at run time then compile time will not be affected.
10 Feb 2022 by Richard MacCutchan
You need to create a timedelta (datetime — Basic date and time types — Python 3.9.10 documentation[^]) of the difference. The following is a simple example; I leave the correct formatting for you: from datetime import datetime , timedelta now =...
27 Oct 2021 by Member 14925860
I am comparing all files in two directories, if comparison is greater than 90% so i continue the outer loop and i want to remove the file in the second directory that was matched so that the second file in the first directory doesn't compare with...
17 May 2021 by Member 15170612
Hello, I would like to create a time entry in the text file in the form of a ranking. Ranking would be sorted by time value. I create WPF Application. What I created will only write time and further writing to the file is no longer possible. ...
17 May 2021 by OriginalGriff
Quote: so again StreamReader reads a text file and then edits it like like MessageBox? No ... a StreamReader does what it says: reads a file from the beginning to the end. And the problem you have is that text files have no organization: you...
12 May 2021 by Member 15170612
Hello, I would like to ask if there is any simple way to multiply the random generated number by the current millisecond? In my WPF Application I generate two random numbers in quick succession and it happens to me that in most cases they are...
12 May 2021 by Abeer Joshi
Yeah that helped me too, thanks everyone :)
12 May 2021 by OriginalGriff
The solution is simpler: don't use Random like that. Declare a single Random instance at class level (static is fine) and use that for both values: private static Random rand = new Random(); ... int maxprvni = 10; int...
12 May 2021 by OriginalGriff
Repost: Deleted. Please do not repost your question; use the Improve question widget to add information or reformat it, but posting it repeatedly just duplicates work, wastes time, and annoys people. I'll delete this one.
25 Apr 2021 by Patrice T
I suspect an error in 𝑝𝑟𝑜𝑐𝑒𝑑𝑢𝑟𝑒 𝑀𝑎𝑡𝐸𝑙𝑒𝑚𝑒𝑛𝑡𝑠𝑆𝑢𝑚(𝐴[0 … 𝑛 − 1,0, … . 𝑚 − 1]) 𝑠𝑢𝑚 = 0; 𝑓𝑜𝑟 𝑖 = 0 𝑡𝑜 𝑛 − 1 𝑑𝑜 𝑓𝑜𝑟 𝑗 = 0 𝑡𝑜 𝑚 − 1 𝑑𝑜 𝑠𝑢𝑚 = 𝑠𝑢𝑚 + 𝐴[𝑖] // I would have expected A[i,j] 𝑒𝑛𝑑...
25 Apr 2021 by Irfan Ullah 2021
Hello All, Thanks for participation and your precious suggestions, I have done some of the algorithms but I stuck in these two, Could you (experts) find time complexity for the following two algorithm with explanation (steps) so I can solve the...
22 Apr 2021 by Member 10850253
I had previously made an app to change windows time in c#, to a previous time, and it used to work fine on windows 7, but now on windows 10 it will just not work. What I have tried: private void button1_Click_1(object sender, EventArgs e) { h1 = h;//hours ...
19 Apr 2021 by CPallini
Consider algorithm 1: there is a statement executed (m*n) times, namely 𝑠𝑢𝑚 = 𝑠𝑢𝑚 + 𝐴[𝑖] Other statements are executed once (e.g. 𝑠𝑢𝑚 = 0;), so, for big values of n and m, their contribution is negligible. Therefore you may write...
19 Apr 2021 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
8 Mar 2021 by honey the codewitch
Traipsing through the ESP-IDF to add some sweet sweet real-time clock functionality
21 Nov 2020 by Dave Kreskowiak
That's not going to happen on Windows. You cannot get that kind of precision on a shared system that is not a real-time O/S. Events like that are guaranteed to happen NO SOONER THAN SCHEDULED. That does not mean exactly as scheduled.
21 Nov 2020 by sara98
Hi, I want click on button at exact time, for example (11:10: 10: 122), without even a few milliseconds of error (or a maximum of 10 milliseconds) my button i wrote this code but has...
23 Sep 2020 by TymekMM
Easy way to measure execution time of the code block
19 Aug 2020 by stackguru
I would like write a python code, with all necessary limits. Say, python code should consume Memory(x MB), Source (y KB) and Time (z Seconds). Can I set these attributes to my code and also log the actual Memory, Source and Time of code along...
19 Aug 2020 by OriginalGriff
As far as I know, you can't really do that - it wouldn't be meaningfully anyway. You could check the source code by reading the file information for your source since Python is interpreted not compiled, but that's about it. Time in seconds? On...
13 Aug 2020 by Sandeep Mewara
I believe the clue is with it being always 9 hours difference. Couldn't it be because of the timezone setup on your system? I checked and PHP time() Function[^] provides the current time as a Unix timestamp in GMT. (timezone independent) I...
13 Aug 2020 by nosajcchio.
Hello! So I have this system setup where it fetches a row [created_at] in the 'videos' table and displays in "Time Ago". The problem is that its not displaying correctly which is making me very confused. The time in the database is correct and...
15 Jun 2020 by Maciej Los
For MS SQL Server database: You can create a stored procedure as is described here: c# - Create SQL Server Agent jobs programatically - Stack Overflow[^] Whenever a client will create schedule, you can use such of procedure to create sql...
15 Jun 2020 by Member 12406065
I need to generate and send a report to customers as per they configured in a portal. We have almost 30 clients, and each client has 20-25 reports. Clients have access to the portal and they can configure their report timing by any...
15 Jun 2020 by RickZeeland
In addition to Garth's answer, you can also use the Windows Task Scheduler to create and execute tasks on remote computers, see: Schtasks.exe - Win32 apps | Microsoft Docs[^] Personally I prefer to call the Windows Task Scheduler with...
15 Jun 2020 by Garth J Lancaster
I would look at a central scheduling service - possibly C# based, using Topshelf for the service framework, Quartz for the cron based scheduled activities kicking a 'message' out via RabbitMQ, where 'messsage' is the Client + Job + Parameters ...
5 May 2020 by anakinche
How do i calculate time between running live time from timer1 and a datetimepicker1.value? What I have tried: I do not know how to do this.I want your ideas.Thank you in advance!
3 May 2020 by phil.o
When you subtract two DateTime values, you get a TimeSpan value representing the duration between them: DateTime startDate = datetimepicker1.Value; Datetime now = DateTime.Now; // The datetime at the tick of the timer TimeSpan duration = now -...
3 May 2020 by Richard MacCutchan
Use the DateTime Struct (System) | Microsoft Docs[^]. It is a good idea to study the documentation so you learn some of the more common and useful classes.
2 May 2020 by anakinche
Friends i have in txtvolume of tank1 10000m3. i empty it with flowrate of 1000m3/h.Can i calculate the time it will be empty and the volume every minute? What I have tried: Several things but do not work i want you to help me if you can
2 May 2020 by Richard MacCutchan
Tank capacity 10,000 m3 Flowrate 1000 m3/hour At a guess that is 10 hours The actual calculation being capacity / flowrate.
4 Mar 2020 by Stefan_Lang
You've made the following errors: 0. This is not C++! I removed the C++ tag from your question. 1. It doesn't make sense to recreate a new calendar instance with every iteration of the loop! Create it outside the loop! 2. Setting the inital time...
4 Mar 2020 by Lania Fatah
hello everyone .. i want to make a time slot that increase by 15 minute i mean that i want to make a time slot like this : 1:00 - 1:15 1:15 - 1:30 1:30 - 1:45 1:45 - 2:00 2:00 - 2:15 . . . . What I have tried: i try and make this method but it...
20 Feb 2020 by Richard Deeming
You only set Time and Time2 in the constructor; you never update them. You're also not raising property change events for those properties, so even if you did update them, the binding wouldn't update. Try something like this: public class...
20 Feb 2020 by Rey21
I want try get binding Time2 show time after my timer count in 5 minute but i don't now how to get it Example : Time show 10.45 AM After I click start and timer finished count Time2 show 10.50 AM. Could you help me how to get it ? It is my...
29 Dec 2019 by sebastian gru
How can I get shamsi time of current time in android device ? shamsi format is like : 1398/10/09 . Is there any function provided in android to get current time for locals like iran ? thanks in advance. What I have tried: I have googled but no result .
29 Dec 2019 by Richard MacCutchan
You can create your own calcualtion based on some fixed starting date in the Persian calendar. See also android persian calendar - Google Search[^].
29 Sep 2019 by Member 14607367
I am to prog some code on C++ which should calculate a fibonacci number in compiler time. So it should look like this: int main() { int v=???6???; } The six is the number of the fibonacci number 8. And the question marks are some symbols which should be added to calculate the fibonacci...
29 Sep 2019 by Richard MacCutchan
See fibonacci sequence - Google Search[^]
29 Sep 2019 by Greg Utas
Hint: use a template whose template parameter is an int. Stronger hint: search online for the same solution for a factorial and adapt it.
7 Aug 2019 by Member 14549747
How can i declare time variables of the form XX:YY and date variables of the form dd-mm-yyyy in MySQL? What I have tried: I'm working on a project about a cinema database and I want to create date and time variables for the start of a movie broadcast
7 Aug 2019 by MadMyche
Actually you cannot; as Date and Time types in most RDBMS systems are actually numbers. It is up to whatever program you are using to view the information to actually format it into a human-recognizable format at the presentation level. The way to do this is to present this is to use the...
7 Aug 2019 by k5054
GIYF: MySQL :: MySQL 8.0 Reference Manual :: 11.3 Date and Time Types[^] If you insist on "dd-mm-yyyy' format, which may be ambiguous if your users expect "mm-dd-yyyy', you may have to google some more to see how to format dates appropriately. I'd suggest you stick with "yyyy-mm-dd", its...
10 Jul 2019 by RickZeeland
TrackYourTime is an open source time tracker written in C++ that can be used for this purpose: GitHub - Allexin/TrackYourTime: Track Your Time - Cross-platform automated time tracker[^] You can download the Windows executable here:...
10 Jul 2019 by Member 14525501
I don't know how to use listview and I don't know how to keep track of time of each window, and keep track of the name of the window in code, pls try your best to help, windows form app (.net framework) sorry there will be no code to show you What I have tried: sorry there is no code bc it...
7 Jul 2019 by OriginalGriff
Just ask Google: public static DateTime GetInternetTime() { HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.Google.com"); WebResponse response = myHttpWebRequest.GetResponse(); string todaysDates =...
7 Jul 2019 by saeed ghasemi
I want one or more functions to open or trace a website and search in it's source codes then returns the server time. What I have tried: I found some code but if I want to say honestly, I wasn't testing them because they were very complex. here's
24 Mar 2019 by Gerry Schmitz
I never understand why folks want to muck with the grid; when adding calculations to the "data source items" seems so much simpler. Like making a meatball sandwich without the meatball. Anyway ... c# - Calculation in DataGridView column - Stack Overflow[^]
23 Nov 2018 by Member 14064645
The best way is to use Thread.Sleep(10000) and then apply the code this.close this will wait for 10 s and afterwards form will be closed
23 Nov 2018 by Michael Waguih
Hi all,I have a form I want to show it for a period of time (say 10 seconds) and then close it,Can I use a code in the Form_Load function to display the form for this time before closing it.Please help me I need a code for doing this.Thanks in advance,:)
7 Nov 2018 by MadMyche
The standard method to determine the average for a particular day is to look average the numbers for that particular day in past years. To guess what the future values will be, you would need to start with the average and then compensate for trends over the last couple of years (are sales have...
21 Jun 2018 by Jochen Arndt
To simplify calculations I would use a structure that does not contain the individual fields but a single or two values. If you only want to support Windows you can use the FILETIME structure (Windows)[^]. Alternatively and for general OS support use the timeval structure (Windows)[^]. Here...
21 Jun 2018 by 11917640 Member
I need a way to manage a date, including milliseconds: get current date and time, add given number of milliseconds to it. The first part is completed. C++ version up to C++14. Thanks. Update: some background. I have a file with timestamp in the beginning, and number of records, each one...
21 Jun 2018 by CPallini
I would Throw away the get_local_date function. Make a time_point_to_timestamp function. Make a timestamp_to_timepoint function. Implement add using the above functions and the time_point::operator+=.
21 Jun 2018 by KarstenK
Than you need the High resolution time functions for Windows. Pay attention to the details as resolution and data type and its size.
12 May 2018 by Member 13817351
Error is: Error C4996 'ctime': This function or variable may be unsafe. Consider using ctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. What I have tried: #include #include using namespace std; int main() { time_t now =...
12 May 2018 by Richard MacCutchan
See ctime_s, _ctime32_s, _ctime64_s, _wctime_s, _wctime32_s, _wctime64_s[^].
12 May 2018 by OriginalGriff
It's not an error, it's a warning. You are using an outdated function (it's been Depreciated[^] ) and it's suggesting a more modern version: ctime, ctime_s - cppreference.com[^] You can ignore it for a simple program like this, or use the newer code.
4 Apr 2018 by Jochen Arndt
What times do you get when you perform the measurements in the reverse order (256, 192, 128)? The bytesToHex() and setText() calls should not be part of the measurement from my point of view. setText() is a GUI operation which might require significant time; especially when called the first...
4 Apr 2018 by lily96
I have tried this code to measure time of the encryption process i want it to measure time based on key length, i do not know where i should change because i get result but it gets lower every time were it should increase more based on the entered key . i work with three keys 128-bit , 192-bit...
19 Feb 2018 by Member 13564659
i dont can to validation time, i use 3 text box, for hours, minutes, seconds What I have tried: $time=$_POST["time_tlp"]; $menit=$_POST["menit_tlp"]; $detik=$_POST["detik_tlp"]; $jam_tlp = $_POST['time_tlp'].':'.$_POST['menit_tlp'].':'.$_POST['detik_tlp']; if (isset($_POST['time_Tlp'] ...
19 Feb 2018 by Member 13564659
its work if (isset($_POST['time_tlp'] )== "" || !is_numeric($_POST['time_tlp']) || ($_POST['time_tlp'])>=23) { echo "alert(' format jam salah ');window.history.go(-1);";} elseif (isset($_POST['menit_tlp'] ) == "" || !is_numeric($_POST['menit_tlp']) ||...
18 Feb 2018 by Jochen Arndt
You are comparing the boolean PHP: isset - Manual[^] return value with an empty string. if (isset($_POST['time_Tlp'] ) == "" which is never true. PHP: is_numeric - Manual[^] checks for any valid numeric value which includes floating point numbers and negative values which are also invalid for...
16 Jan 2018 by P.Gnanaraj
I have developed a .NET dll using c#.net targeted to framework 4.0 . Now I need to implement the licensing functionality. I want to implement the Design time licensing feature which is nothing but during the development time in visual studio. How to achieve this? Please do help.. Basically...
16 Jan 2018 by Pete O'Hanlon
It's possible but of very little value. As .NET is interpreted, it's not too hard to read the IL (yes, there are some hacks that prevent apps like Reflector from doing this but they can be worked around). Once you have the IL, you have the source. There's very little you can do to prevent a...
23 Dec 2017 by Afzaal Ahmad Zeeshan
You can create a new calendar control using jQuery UI. Datepicker | jQuery UI[^] For the database, you can use the PHP helpers for your database providers. For example, for MySQL and PHP you can follow this tutorial; PHP and MySQL[^].
20 Dec 2017 by ICEFLOWER2
How Can I Take Date and Time of other computers over Lan??! Why This script not work currectly at my Network? What I have tried: Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime") strComputer = "DESKTOP-2ACDFQ" Set objWMIService =...
30 Oct 2017 by navneet@ISM
UTC time record 5 hours before start of Spring Day Light Saving, displays 1:00 to 1:59 UTC time duration am twice. First, from 8:00 pm to 8:59 pm and then again from 9:00 pm to 9:59 pm. UTC time becomes normal 3:00 am again at local 10 pm time. when local time goes to 8:59 pm to 9:00 pm on 11...
30 Oct 2017 by Jochen Arndt
See the SystemTimeToFileTime function (Windows)[^] documentation: Quote: Converts a system time to file time format. System time is based on Coordinated Universal Time (UTC). and SYSTEMTIME structure (Windows)[^]: Quote: The time is either in coordinated universal time (UTC) or local time,...
29 Aug 2017 by Rodrigo Alex Rodriguez
private void button1_Click(object sender, EventArgs e) { TimeSpan a = new TimeSpan(12, 00, 00); TimeSpan b = new TimeSpan(13, 00, 00); TimeSpan r = b - a; TimeSpan rr = new TimeSpan(r.Ticks / 2); ...
29 Aug 2017 by Jochen Arndt
You can not convert a time span to a datetime. You might add the span to a specific datetime (e.g. the current time). If the span is always positive and less than 24 hours, you can use the DateTimePicker with the time only (see How to: Display Time with the DateTimePicker Control | Microsoft...
29 Aug 2017 by OriginalGriff
You can't convert a Timespan to a DateTime: that doesn't work because it's not a logical action. Think about it: If I ask you to meet me at "plus 6 hours 30 minutes" what does that mean? Nothing - unless it's understood that there is a starting point for it to be relative to. In terms of normal...
15 Aug 2017 by Vishal Gupta
I am getting the error of time limit exceeded while executing the code in hackerearth compiler, the code is giving the correct output but while submitting the code the time limit exceeds, please help in this code, is it not optimized. What I have tried: #include main() { long...
15 Aug 2017 by Patrice T
Those sites are giving you challenges. Quote: is it not optimized. Optimizing is exactly the object of the challenge. Most strait forward solution is never the right solution. Your program is optimum if requested 1 sum, but not if you are requested many partial sums. Said otherwise, the...