Questions tagged [time]

Measuring the time it takes to perform an operation. Also, questions related to obtaining the current time, calculating on times, formatting and parsing times, etc.

Measuring the time it takes to perform an operation. Also, questions related to obtaining the current time, calculating on times, formatting and parsing times, etc. See also and .

For analysis in , consider looking at the Time Series Task View.

29686 questions
8
votes
3 answers

PHP Calculating Time Difference in Hours Between Two Timezones

I need to work out the difference in hours between two timezones and I am running into some issues when the timezone that is ahead moves to the next day. Example: //Let's say it is 11pm 23:00 in LA $local_tz = new…
MP_Webby
  • 916
  • 1
  • 11
  • 35
8
votes
4 answers

How to measure elapsed time using DateTime class?

I am encountering a strange behavior here. Control never comes out of the do-while loop. On debugging i found that the value of the variable interval decreases during some of the loops, instead of increasing! I'm missing something obvious here, but…
Martin
  • 3,396
  • 5
  • 41
  • 67
8
votes
1 answer

How to get current date and time from DB using SQLAlchemy

I need to retrieve what's the current date and time for the database I'm connected with SQLAlchemy (not date and time of the machine where I'm running Python code). I've seen this functions, but they don't seem to do what they say: >>> from…
bluish
  • 26,356
  • 27
  • 122
  • 180
8
votes
5 answers

GPS time in weeks since epoch in Python?

I want to convert from Unix Time to GPS Time, i.e. calculate the number of weeks since the beginning of the GPS epoch (January 6, 1980) in Python. I am not looking for the weeks in a year but the weeks since 1980. To start my attempt has been to get…
Ansh Sehgal
  • 111
  • 1
  • 4
8
votes
5 answers

How can I keep raspberry timekeeping accurate?

I have 3 Raspberry 3 Model B devices. Their operation system is Windows 10 IOT, they were installed on the same day (yesterday). I have very strange experiences with their timekeeping, they are highly inaccurate. Some of them some secs behind the…
Tom
  • 3,899
  • 22
  • 78
  • 137
8
votes
3 answers

Calculate average daily value from large data set with R standard format date/times?

I have a dataframe of approximately 10 million rows spanning about 570 days. After using striptime to convert the dates and times, the data looks like this: date X1 1 2004-01-01 07:43:00 1.2587 2 2004-01-01 07:47:52 1.2585 3…
Patty
  • 167
  • 1
  • 2
  • 11
8
votes
1 answer

Select only rows that occur at specific time

I have read in C.csv and the datetime column is a object type. I want to get every row that has 23:45:00 in it, regardless of date. I would like to have datetime as index and i would like to convert datetime index to datetime64[ns]. I believe pandas…
Ross Demtschyna
  • 333
  • 5
  • 18
8
votes
2 answers

C++ time measurement looks too slow

I am programming a game using OpenGL GLUT code, and I am applying a game developing technique that consists in measuring the time consumed on each iteration of the game's main loop, so you can use it to update the game scene proportionally to the…
Jaime_mc2
  • 673
  • 5
  • 18
8
votes
3 answers

JavaScript - difference between two time strings

I need to compare two different datetime strings (formed: YYYY-MM-DD'T'HH:mm). Here are the datetime strings: var a = ("2017-05-02T10:45"); var b = ("2017-05-02T12:15"); I've sliced the dates out of them so I only need the time (formed: HH:mm). var…
IlariM
  • 376
  • 1
  • 3
  • 16
8
votes
1 answer

Golang time - time zone showing twice

On running this code the result should show date time and zone Surprisingly the result shows time zone twice and am not able to figure out why package main import ( "fmt" "time" ) func main() { mytime, _ :=…
Tahseen
  • 1,027
  • 1
  • 12
  • 32
8
votes
4 answers

Current time is older than the previously saved time

My assumption is that time always runs forward, but apparently sometimes it doesn’t happen this way. I have the following example: var LOOP_MS = 100; var prevCall = +new Date(); setTimeout(function loop() { foobar(); setTimeout(loop,…
Daniel J F
  • 1,054
  • 2
  • 15
  • 29
8
votes
3 answers

How to get equivalent time in another timezone

I'm trying to compare two times from different timezones, and see whether one is before the other. How would I do this in Go? Note: Basically I would like sfTime.Before(nyTime) == true, but my example below would have sfTime.Before(nyTime) == false.…
hlin117
  • 20,764
  • 31
  • 72
  • 93
8
votes
1 answer

why ZonedDateTime class does not implement TemporalAdjuster interface

I'm currently studying java.time API and I have noticed that majority of class (e.g. LocalDate, OffsetDateTime) in java.time implement TemporalAdjuster interface, but ZonedDateTime does not. I was just wondering why this is the case? Why exclude…
Thor
  • 9,638
  • 15
  • 62
  • 137
8
votes
2 answers

How to show one hour later from now or one hour before now in ruby

x = Time.now y = 1.hours.from_now z = 1.hours.before_now i'm sorry if this question too stupid. i want to know an effective way to show one hour before and after now in ruby. thanks for watching and for helping.
user7423927
8
votes
3 answers

Java 8 date/time: instant, could not be parsed at index 19

I have following piece of code: String dateInString = "2016-09-18T12:17:21:000Z"; Instant instant = Instant.parse(dateInString); ZonedDateTime zonedDateTime = instant.atZone(ZoneId.of("Europe/Kiev")); System.out.println(zonedDateTime); It gives me…
Green Root
  • 644
  • 2
  • 10
  • 28