Questions tagged [seconds]

333 questions
7
votes
2 answers

PHP Calculating Game Energy Consumption Timescale

What I Am Trying To Achieve In an on-line game, you can achieve awards and other energy based goals. One could require a total of 24,000 energy which is a time based one, whereas others only 25. Based on starting with 0 energy and no lost energy…
Tyler
  • 854
  • 1
  • 10
  • 26
7
votes
3 answers

Do something every x (milli)seconds in pygame

I'm learing Python and Pygame, and my first thing I'm making is a simple Snake game. I'm trying to make it so that the snake moves once every 0.25 seconds. Here is the part of my code that loops: while True: check_for_quit() …
RedRocker227
  • 175
  • 1
  • 3
  • 6
7
votes
2 answers

How to create timestamp in seconds

I have this task to populate this field: x_fp_timestamp is the timestamp created when the form is generated. It is equal to the number of seconds since January 1, 1970 in UTC (Coordinated Universal Time). So what I do in C# is long ts = …
NoWar
  • 36,338
  • 80
  • 323
  • 498
6
votes
5 answers

How do I get seconds since 1/1/1970 of a Python datetime object?

I'm using Python 3.7 and Django. I wanted to get the number of seconds (or milliseconds) since 1/1/1970 for a datetime object. Following the advice here -- In Python, how do you convert a `datetime` object to seconds?, I implemented now =…
Dave
  • 15,639
  • 133
  • 442
  • 830
6
votes
3 answers

Calculations with minutes and seconds in R

I'm new to the R statistics software and I roast coffee and record different events during the process. After the roasting process I would like to use R to do some calculation and analysis and derive important durations during the period by finding…
Morten Münchow
  • 73
  • 1
  • 1
  • 6
6
votes
9 answers

.NET constant for number of seconds in a day?

Does .NET have a constant for the number of seconds in a day (86400)?
lance
  • 16,092
  • 19
  • 77
  • 136
6
votes
5 answers

How to round off timestamp in milliseconds to nearest seconds?

How to round off the current timestamp in milliseconds to seconds? If this is the current timestamp in milliseconds I have - 1384393612958 The if I am rounding off to nearest second then will it be like this? Time in MS rounded off to nearest…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
5
votes
0 answers

Django filter for converting the number of seconds into a readable form

I have model: class Track(models.Model): artist = models.CharField(max_length=100) title = models.CharField(max_length=100) length = models.PositiveSmallIntegerField() where length is the duration of track in seconds I have template: {%…
Cosmologist
  • 508
  • 1
  • 5
  • 16
5
votes
2 answers

Python: Converting a seconds to a datetime format in a dataframe column

Currently I am working with a big dataframe (12x47800). One of the twelve columns is a column consisting of an integer number of seconds. I want to change this column to a column consisting of a datetime.time format. Schedule is my dataframe where I…
Hestaron
  • 190
  • 1
  • 8
5
votes
1 answer

Pandas - Convert HH:MM:SS.F string to seconds - Caveat : HH sometimes goes over 24H

I have the following dataframe : **flashtalking_df =** +--------------+--------------------------+------------------------+ | Placement ID | Average Interaction Time | Total Interaction Time…
Matteo M
  • 137
  • 2
  • 8
5
votes
2 answers

Python: Pandas Series - Difference between consecutive datetime rows in seconds

I have a pandas Series called 'df' as follows value date_time_index 2015-10-28 01:54:00 1.0 2015-10-28 01:55:00 1.0 2015-10-28 01:56:00 1.0 2015-10-28 01:57:00 1.0 2015-10-28 01:58:00 1.0…
Runner Bean
  • 4,895
  • 12
  • 40
  • 60
5
votes
2 answers

how to count the seconds in java?

I'm trying to understand how I could go about keeping track of the seconds that an object has been created for. The program I'm working on with simulates a grocery store. Some of the foods posses the trait to spoil after a set amount of time and…
chank062
  • 73
  • 1
  • 1
  • 4
5
votes
5 answers

How to make Java program exit after a couple of seconds

Is there anyway I can exit a java program after a couple of seconds e.g. 5 seconds. I know you can quit the java program using: System.exit(0); But I'm not sure whether the 0 stands for seconds since this code: System.exit(10); also exits…
EmaadP
  • 160
  • 1
  • 1
  • 10
4
votes
3 answers

Casting double chrono::seconds into millisecond

im have simple function like void foo(std::chrono::milliseconds ms) { std::cout << ms.count() << " milliseconds" << std::endl; } and next im calling them by int main() { using namespace std::chrono_literals; boo(3s); boo(1h); …
Illusion
  • 43
  • 3
4
votes
1 answer

How Do I create a countdown timer with minutes and seconds in swift?

I can't find a single tutorial that does countdown timer with minutes and seconds. There's one or two but they are kind of bad. import UIKit class HomeViewController: UIViewController { @IBOutlet weak var focusSession: UILabel! @IBOutlet…
YungGoat
  • 123
  • 1
  • 9
1 2
3
22 23