time

What is the Best Way to Perform Timestamp Comparison in Bash

I have an alert script that I am trying to keep from spamming me so I'd like to place a condition that if an alert has been sent within, say the last hour, to not send another alert. Now I have a cron job that checks the condition every minute because I need to be alerted quickly when the condition is met but I don't need to get the ema...

Matching a time string with a regular expression

I would like to match the time (10.00) from a string with the date and time ("21.01.08 10.00"). I'm using the following regular expression: new RegExp("\\b[0-9]{1,2}\\.[0-9]{1,2}\\b" "g"); But this matches 21.01 from 21.01.08 and 10.00. I'm using PCRE as my regualar expression engine. Update: I'm sorry, i should have more been mor...

Does Windows provide a monotonically increasing clock to applications

This question is inspired by Does Linux provide a monotonically increasing clock to applications. Maybe I should be more precise: I'm looking for a clock function which is strictly increasing, thus never returning the same value, independant how quick two calls follow each other. ...

How does _ftime / Windows internal time work?

Hi guys, I have found an interesting issue in windows which allows me to cause the Windows clock (but not the hardware clocks) to run fast - as much as 8 seconds every minute. I am doing some background research to work out how Windows calculates and updates it's internal time (not how it syncs with an NTP servers). Any information anyon...

How to deal with time storage in SQL

I have a web application that I'm writing (C#, MSSQL) and I need to store the timestamp when a record is stored in the system. Normally, I would just do this with SQL and the DATETIME function. However, the server is located in a different time zone than our company is located... AND we may change to another server in completely differ...

Convert time fields to strings in Excel

I have an excel sheet full of times. They are formatted so that they look like: 1:00:15 However if I change the format on the cells to text, they change to the underlying numeric representation of the time: 0.041840278 How can I convert the cells to be text cells but still have the time in them ? ...

How to transform time value into YYYY-MM-DD format in Java

long lastmodified = file.lastModified(); String lasmod = /*TODO: Transform it to this format YYYY-MM-DD*/ ...

What is the preferred format to store date/times in a SQL Server database when PHP is your primary language?

I am planning a PHP application that needs to store date/times in an MSSQL database. (For the curious, it is a calendar application.) What is the preferred format to store this information? MSSQL has its own datetime data type, which works well in the database itself and is very readable. However, there aren't any MSSQL functions to tra...

Date time parsing that accepts 05/05/1999 and 5/5/1999, etc...

Is there a simple way to parse a date that may be in MM/DD/yyyy, or M/D/yyyy, or some combination? i.e. the zero is optional before a single digit day or month. To do it manually, one could use: String[] dateFields = dateString.split("/"); int month = Integer.parseInt(dateFields[0]); int day = Integer.parseInt(dateFields[1]); int year ...

NTPD: use an unrestricted port for communication

When querying ntp servers with the command ntpdate, I can use the -u argument to make the source port an unrestricted port (port 1024 and above). With ntpd, which is meant to run in the background, I can't seem to find a way to turn this option on. So the source port is always 123. It's playing around horribly with my firewall configur...

Javascript World Timezone Difference to GMT Calculator

Dear everyone I was hoping someone could send me in the direction of a regularily updating time zone database. I have found one, but apologies i cant remember where it was from, however with the current GMT clock change fast approaching, i fear all my data will be incorrect, ie the differences from UK to New Yrok will change from 5 hou...

How do I record the time every time I log on and log off of Windows XP?

I notice that Windows XP Event Viewer show a list of typical actions under System logs every time I start or shutdown Windows, and I can tell when my day starts and ends. Is there anyways I can record the time every time I lock my screen and every time I re-login? There maybe a way to fool System Event Logger into submission, but a fre...

Is there a central repository for time zone information

I know that systems are using their own time zone databases at different levels. Is there a central place where all timezeone and DST information lives, that makes it easy for programmers to write updates to their time zone data sources? For example, do people make provisions for a time zone for each possible combination? For example, ...

QT: Fast way to measure time?

I'm looking for the equivalent in QT to GetTickCount() Something that will allow me to measure the time it takes for a segment of code to run as in: uint start = GetTickCount(); // do something.. uint timeItTook = GetTickCount() - start; any suggestions? ...

What time format is this? (not UNIX, not UTC, nothing)

I'm importing data from another system to MySQL, its a CSV file. The "Date" field however contains cryptic of 3-digit time entries, here's a random sample set: > 540 > 780 > 620 > 965 What's this? obviously its not 5:40 and 6:20. But it's not UNIX either (I tried 1225295**XXX** before I realized the time range this represents is about...

How do I compare an epoch time against 24 hours ago in SQL Server?

I am using MS SQL Server 2005, I have dates stored in epoch time (starting 1970) I need to create a statement that will affect any record that has not been updated in the last 24 hours. ...

What is the time complexity of this Scheme function?

What is the time complexity? Why? (define (mult a b) (define (internal a accum) (if (= a 1) accum (internal (- a 1) (+ accum b)))) (internal a b)) (define (to-the-power-of m n) (define (internal x accum) (if (= x 0) accum (internal (- x 1) (mult accum m)))) (internal n...

How can I find the time since an event happened?

The event returns a standardized timestamp in the format of "Sat Oct 25 21:55:29 +0000 2008" How can I compare this with the current time in PHP so that it gives me the result in a form like "It has been 15 minutes!" or "It has been three days!" Also, how can I get the current time? ...

Time Code in PLT-Scheme

I want to see how long a function takes to run. What's the easiest way to do this in PLT-Scheme? Ideally I'd want to be able to do something like this: > (define (loopy times) (if (zero? times) 0 (loopy (sub1 times)))) > (loopy 5000000) 0 ;(after about a second) > (timed (loopy 5000000)) Took: 0.93 se...

making a programme run indefinitely in python

Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a time has passed, rather than until a number reaches a certain point? ...