Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [time]

The tag has no usage guidance.

-2
votes
0answers
30 views

Run time of Algorithm with nested loop

(a1,...,an)(b1,...,bm) x <- 0 i <- 1 while i < n and ai > 0 do for j <- i to m do x <- x + ai x bj i <- i + 1 return x So with this algorithm I've been ...
3
votes
2answers
128 views

Best way to model UTC time and deltas in embedded C

I'm getting ready to do some work on an embedded firmware prototype that has a GPS chip attached to it (straight C on an arm0, no OS). I'm torn on how to model UTC instants and time deltas. ...
2
votes
2answers
105 views

How to store sequential timespans in a database?

How can consecutive periods of time (defined by a start and end date) be stored in a database? For example: from 2018-01-01 00:00:00+01:00 until 2018-06-01 00:00:00+02:00 from 2018-06-01 00:00:00+02:...
2
votes
2answers
119 views

Appropriate way to handle timezone for embedded/IoT devices

I am writing some data collection software (in python) that will transmit data to the cloud. I am including a timestamp (using the standard datetime module included with python) in the data record so ...
5
votes
4answers
202 views

Should I inject a Thread.sleeper as a dependency to make unit test easer?

I have a repeated pattern in my code that is not easy to test: classes that execute periodically. Just to simplify things lets say assume something like: while( running ){ long millisToWait = ...
-4
votes
1answer
87 views

How do I know a product is in the “will_expire” state? [closed]

I am developing a software system and in it there are time-measured products. The customer buys the product for a period of time, such as one month. If the user does not list their products everyday, ...
1
vote
2answers
110 views

Distinction between “timestamp” and “datetime” [closed]

Is it common to use "timestamp" to mean with time zone and "datetime" to mean without time zone?
1
vote
3answers
149 views

How to schedule “piece of string” tasks

We have an old database which is used to hold supporting information about the financial system. Most of the actual code in are in Views which consolidate the supporting data with the financial data (...
1
vote
0answers
547 views

Why does clock() function in C from <time.h> header only returns clock ticks in increments of 10's of thousands?

I am curious to know why does the function clock() only returns values in increments of 10,000 and is not able to return values in between. I have the following code: #include<iostream> #...
2
votes
2answers
223 views

Can we assume that a postal code has only one time zone?

This is a simple question, but one I've never seen a definitive answer for: In the majority of the world that has postal codes, is it safe to assume that given a postal code, there is only one time ...
2
votes
2answers
179 views

How do you manage date-ranges, when datatypes include time?

How does one conceptually manage date-ranges, specifically the ending-date when there is a time-component involved (as in JavaScripts Date, C# DateTime, MS-SQLs datetime2). For example, humans ...
0
votes
1answer
45 views

How to know which call is correct when multiple potential calls to API each new one invalidates the old one

I have a react element that will potentially call an API multiple times in a short amount of time. Every new call would invalidate the old one as it is a pricing request to the server. Is there a way ...
4
votes
2answers
185 views

Why doesn't Git set the file time?

Git by default lacks the logic to set the file-time accordingly when the files are synced with the origin. It just ignores the file-time of the origin, and IMO this is a really annoying behavior. ...
4
votes
2answers
222 views

Working with data and time intervals

I have an application that measures that continuously. (About every second - it depends on the device) For example sake, let's say that data is CPUTemp (as used as an example in an answer to a related ...
2
votes
2answers
406 views

Is a procedure's complexity a function of how many nested loops it has?

Take this example public static boolean uniqueNumbers(int[] x){ for(int i = 0; i <x.length; i++){ for(int j = 0; j <x.length; j++){ if(i != j && x[i] == ...
1
vote
0answers
450 views

How do you handle time unit constants (second, minute, etc)?

I've been writing a lot of time related code recently, and in various files, I always end up re-defining things like var SECOND = 1000; var MINUTE = 60 * SECOND; This gets frustrating quickly. So I'...
3
votes
3answers
307 views

Best practice for using time

I am making a desktop based financial app in Ruby On Rails for my friend. I have a little concern over the system time I am using since time log being very important. What if system time changes ...
4
votes
4answers
263 views

Is Program Running Time Affected by File Size?

Say I wrote a program containing 3 methods. Each method was 100 lines. Method 1 was main(), and Method 2 was called by main(). I then duplicated the program into an identical second program. After ...
-1
votes
1answer
48 views

Time complexity Computation

What will be the result of the time complexity of this piece of code i.e. int sum(int A[], int n) { int sum = 0, i; for(i = 0; i < n; i++) { sum = sum + A[i]; } ...
2
votes
3answers
277 views

Data from devices with unreliable clocks

Are there any viable approaches to dealing with data coming from devices with unreliable clocks? We have a database system running on a central server. The latest addition to the system is a bunch of ...
2
votes
1answer
73 views

Designing Storage for Different Time Systems

I've been considering doing some kind of application that allows users to track events in mythical settings. However, not all mythical settings allow for normal times. What if one user wants star ...
-2
votes
1answer
88 views

What is an element of a schedule called? [closed]

I have a question about software modeling terminology, when modeling time. Say you have a repeating schedule MWF 4-5 p.m. What do you call Monday 4-5 p.m.? What's the term for that? using System; ...
5
votes
1answer
75 views

Prove complexity for a generic algorithm

I'm new to theory of complexity and am trying to prove a fact. So, let's consider an algorithm T that receive at input an integer n. That algorithm has a time complexity for n = 1 : θ(1) and for n > ...
2
votes
0answers
38 views

Realtime layered time data storage and calculations

I am having a hard time trying to figure out the best way to report on and calculate layered time data. The problem: A person can sign in multiple times, during this sign in there are multiple ...
6
votes
2answers
409 views

Does Time Complexity analysis factor for cache performance of an algorithm?

If I have an algorithm A. and it has fewer instructions than algorithm B. but performs worse on a CPU due to poor memory coalescing (and hence, poor CPU cache performance), does that factor into the ...
2
votes
3answers
459 views

Temporary Variables or Not: Choose CPU Time or RAM? [duplicate]

In a case where multiple variables are set equal to an operation using the result of an other operation, is it best to create a temporary variable for the result of the second operation (this would ...
5
votes
2answers
3k views

What is time complexity of update in binary heap?

For a binary heap we have O(log(n)) for insert, O(log(n)) for delete min and heap construction can be done in O(n). In the context of using a binary heap in Djikstra, my exam paper involved an "...
9
votes
4answers
7k views

Should a REST API be able to convert datetime to appropriate clients timezone?

Whilst implementing our API, the issue of datetime and timezones came up. All dates are normalized to UTC in the database. Currently, in the non-API application, all datetimes are converted based on ...
0
votes
1answer
270 views

Ever-running timed tasks

I need to design a piece of software which is invoking some actions regularly. By regularly I mean that there is x things that need to be done at 12.00, y things at 12.30 etc,etc. The times and ...
0
votes
1answer
1k views

Tracking hours with clock in/out

I am working on a web interface that would allow the user to keep track of the amount of time people spend at their establishment. The problem: I don't know what the best way to keep track of this ...
3
votes
3answers
156 views

What is an accepted method of timestamping in a distributed system?

In a normal application, a simple call to time.Now() in most languages will suffice for getting a timestamp, but what about in a web application spread over multiple servers? As I understand it time....
4
votes
1answer
19k views

When passing dates/datetimes as url parameters in an API, which format is better - unix timestamp or date string (ISO 8601) [closed]

Interesting question came up at work in regards to the better format of passing a date/datetime as a url parameter in an API: Is it better to pass as a unix timestamp, or as a plaintext date string (...
3
votes
1answer
1k views

Why do browsers clamp timeouts and intervals?

I've been working on some abstractions of setTimeout and setInterval in order to process large sets of data without blocking the event loop in the browser. Upon this, I have discovered that browsers "...
2
votes
3answers
232 views

How was the system clock first used in early computers?

This question is about the clock that keeps current time, not about the signal that sequences the circuitry (the wall clock, not the metronome). First computers were pure calculators, just very large,...
1
vote
2answers
1k views

how to deal with different formats of 'time/date format'?

Different systems accepts different formats of formating time. E.g. java, jquery: yyyy-MM-dd HH:mm some jquery plugins: yy-mm-dd HH:MM momentjs: YYYY-MM-DD HH:mm ISO-8601: YYYY-MM-DD hh:mm etc On ...
3
votes
3answers
1k views

How much time should you allow for clock skew?

We are writing a B2B application that uses OAuth 2.0. Before a token expires we want to refresh it since it faster to refresh a token, than request a new one. However, we want to build in some ...
1
vote
1answer
347 views

Where does Rails get its datetime for creating records?

I have a rails app with a data model called 'jobs' and I'm faced with a critical design choice crossroads. I don't know enough about Rails and its inner workings to be able to say for sure what I ...
-2
votes
1answer
146 views

What does this duration reported by ffmpeg mean? [closed]

When I run ffmpeg on an mp4 file, it says the duration is: 00:03:57.54 What is the unit that 54 represents ? I am interpreting it as 0.0054 seconds (54 milliseconds).
0
votes
1answer
101 views

Running time question

I have an array A of n integers, sorted from min to max, and two numbers a<=b, which are known to be in A. I would like to write a pseudo-code for a procedure whose running time is c1+c2log(n) and ...
0
votes
4answers
584 views

When to store Date/DateTime?

I'm working on a social network website and I'm not quite sure when I should store the date/datetime. The service includes some of the following events: Register/Login Follow "Like" (images & ...
0
votes
2answers
166 views

Bucketing model by time

I have a model which has timestamped entities. Now I want to do bucketing - "buckets" of entities which can be reasoned about a single entity. Also I want to be able to access related entities from a ...
1
vote
1answer
299 views

Representation of time expanded graph

I want to build a time expanded graph with time discretization Dt that starts at t = 0 and ends at t = T where between the node (n1, t) and the node (n2, t') is an arc if and only if (n1, n2) were ...
2
votes
1answer
153 views

Date & time - apply current, or 'then' DST?

I'm designing a function that given a UTC timestamp will convert it to the local time. The question I have, should the current times DST settings be applied to the conversion, or the timestamps DST ...
0
votes
2answers
127 views

Sending exactly one notification n seconds after the event

I have a system that checks the status of a number of systems, such as, is http up, does the system respond to ping, that sort of thing. I check all of these systems every 5 minutes. If something is ...
8
votes
4answers
8k views

What is the best practice for saving TimeZones in the database?

We want to start collecting timezones for each of our addresses in the database. What is the best practice to store the timezones? How would you go about acquiring timezones for the existing address ...
19
votes
1answer
2k views

Noda Time vs Joda Time?

In the Noda Time User's Guide, the rationale section states: the public API has been largely rewritten, both to provide an API which is more idiomatic for .NET, and also to rectify some of the Joda ...
4
votes
4answers
2k views

(Dis)advantages of datetime vs. long in globally used applications [closed]

I am currently designing a web/mobile application the bulk of whose users will be distributed across the different U.S. time zones with a potential of scaling up to other countries and time zones as ...
7
votes
2answers
2k views

Is a day really 24 hours long? [closed]

I asked this question on Stack Overflow and it was closed as off-topic. I'll ask it here hoping it will do better. This might sound silly, but bear with me. I've been working a lot with intervals and ...
0
votes
2answers
262 views

How to handle timezone for dates?

With a YYYY-MM-DD HH:MM:SS date I always store the UTC time. When I pull to display I translate timezones with built-in PHP functions and classes. I believe that is one correct way to do it and it ...
6
votes
3answers
1k views

Is the addition of a duration to a date-time defined in ISO 8601?

I've writing a date-time library, and need to implement the addition of a duration to a date-time. If I add a 1 month duration: P1M to the 31st March 2012: 2012-03-31, does the standard define what ...