Questions tagged [intervals]

Intervals are used to measure “distance” between values.

Intervals are used to measure “distance” between values.

In the DBMS world interval typically refers to the period between 2 timestamps, many modern RDBMS systems natively supports intervals and operation with them.

More information on the intervals can be found in the wild.

2903 questions
21
votes
4 answers

Get interval in milliseconds

I have a procedure that contains code like this: processStart := current_timestamp; -- run statement(s) processEnd := current_timestamp; elapsed := processEnd - processStart; raise notice 'My Statement, elapsed time: %', elapsed; The idea is, I…
Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
20
votes
1 answer

How to operate on PostgreSQL interval datatype using jdbc/spring-jdbc not using PGInterval?

Java date & time datatypes are as everybody knows, there's no need to focus on that. However, when I'm using JDBC or Spring-based extensions, such as SimpleJdbcTemplate to retrieve and store interval values, what Java type should I use, if I don't…
Danubian Sailor
  • 1
  • 38
  • 145
  • 223
20
votes
4 answers

Run a function in time interval in jQuery

I want to make a banner by using jQuery. When the page loaded script will show a group of photos one by one. For example, the controller sends 10 photos and each photo will be shown in 30 seconds after 10 minutes the script demand another photo from…
Sesen
  • 362
  • 2
  • 4
  • 17
20
votes
3 answers

How do I calculate interval between two datetime2 columns (SQL Server)?

Hi I'm trying to calculate the difference between two columns of datetime2 type. However SQL server (2012) doesn't seem to like the following: select cast ('2001-01-05 12:35:15.56786' as datetime2) - cast ('2001-01-01 23:45:21.12347' as…
Kevin Tianyu Xu
  • 646
  • 2
  • 8
  • 15
19
votes
4 answers

IOS - Creating & Using Interval Specific Timers

I am a newbie IOS developer, but I have a good amount of experience in Android development. My question is regarding the creating and use of interval specific timers. In android I could easily make a timer like this: timedTimer = new Timer(); …
user879702
  • 211
  • 1
  • 2
  • 5
19
votes
4 answers

Finding matching interval(s) in pandas Intervalindex

There's this interesting API called Intervalindex new in 0.20 that lets you create an index of intervals. Given some sample data: data = [(893.1516130000001, 903.9187099999999), (882.384516, 893.1516130000001), (817.781935, 828.549032)] You can…
cs95
  • 379,657
  • 97
  • 704
  • 746
19
votes
6 answers

Union of intervals

I've got a class representing an interval. This class has two properties "start" and "end" of a comparable type. Now I'm searching for an efficient algorithm to take the union of a set of such intervals. Thanks in advance.
drvj
  • 355
  • 1
  • 4
  • 9
18
votes
3 answers

Rounding a Java BigDecimal to the nearest interval

I have a BigDecimal calculation result which I need to round to the nearest specified interval (in this case it's the financial market tick size). e.g. Price [Tick Size] -> Rounded Price 100.1 [0.25] -> 100 100.2 [0.25] -> 100.25 100.1 [0.125] ->…
Jon
  • 5,247
  • 6
  • 30
  • 38
18
votes
1 answer

Android - Find out what hour of day it is

I want to use and alarmManager that sets a repeating alarm to go off on the hour, every hour. I know how to set a repeating alarm every hour but not how to actually set it from the top of the hour, I need to know this value for the 'whatTime'…
bobby123
  • 1,006
  • 4
  • 14
  • 24
18
votes
2 answers

Interval datatype in Pandas - find midpoint, left, center etc

In pandas 20.1, with the interval type, is it possible to find the midpoint, left or center values in a series. For example: Create an interval datatype column, and perform some aggregation calculations over these intervals: df_Stats =…
penguin
  • 439
  • 1
  • 5
  • 13
18
votes
5 answers

How to make calculation on time intervals?

I have a problem ,i solve it but i have written a long procedure and i can't be sure that it covers all the possible cases . The problem: If i have a main interval time (From A to B), and secondary interval times (Many or no) (`From X to Y AND From…
Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392
17
votes
3 answers

ISO 8601 Repeating Interval

Wikipedia gives an example of an ISO 8601 example of a repeating interval: R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M This is what this means: R5 means that the interval after the slash is repeated 5 times. 2008-03-01T13:00:00Z means that the interval…
kzh
  • 19,810
  • 13
  • 73
  • 97
17
votes
2 answers

How can I use Tokio to trigger a function every period or interval in seconds?

In Node.js I can set the interval that a certain event should be triggered, function intervalFunc() { console.log('whelp, triggered again!'); } setInterval(intervalFunc, 1500); However the interface for Tokio's interval is a bit more complex. It…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
17
votes
2 answers

StopWatch vs Timer - When to Use

Forgive me for this question, but I can't seem to find a good source of when to use which. Would be happy if you can explain it in simple terms. Furthermore, I am facing this dilemma: See, I am coding a simple application. I want it to show the…
user4835507
17
votes
5 answers

How to add markers on Google Maps polylines based on distance along the line?

I am trying to create a Google Map where the user can plot the route he walked/ran/bicycled and see how long he ran. The GPolyline class with it’s getLength() method is very helpful in this regard (at least for Google Maps API V2), but I wanted to…
mikl
  • 23,749
  • 20
  • 68
  • 89