timestamps

Converting days since epoch to seconds since epoch

At my new workplace, they represent a lot of dates as "days since epoch" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the conversion: function daysToTimestamp(days) { return Math.round(+days * 86400); } By way of exam...

How can I import a directory structure into SVN, keeping the file and folder modifed dates the same?

I've got a large source tree (> 2 GB, WINCE build tree) that I would like to start managing with Subversion. Up to this point, 'versioning' has been managed through keeping multiple copies of the tree, and using Beyond Compare to find differences. The last big stumbling block I see to using Subversion is that it modifies the file timest...

Linux file creation timestamp race conditions

I'm trying to do what I think is a simple thing under Linux. I have a bash script which runs various test programs, and I want to determine which files in the current directory were created by the test programs. So I am doing something like this: touch timestamp-file run the test find -newer timestamp-file -type f > list-of-files rm -f...

Formatting timestamps

How do you format Rails timestamps in a more human-readable format? If I simply print out created_at or updated_at in my view like this: <% @created = scenario.created_at %> Then I will get: 2009-03-27 23:53:38 UTC ...

Timestamps look different

In Rails, I find that timestamps in the console look different to the actual html view even when you have the same code. Unless I'm doing something really stupid: >> article = News.first => #<News id: 1, title: "Testing", body: "yadda yadda", role_id: 1, created_at: "2009-04-12 05:33:07", updated_at: "2009-04-12 05:33:07"> >> article.cr...

winapi - non-sense file timestamps?

I can't seem to get a reliable timestamp using winapi functions. For example: int main(int argc, char *argv[]) { HANDLE file; BY_HANDLE_FILE_INFORMATION finfo; SYSTEMTIME systime; file = CreateFile("test.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); GetFileInformationByHandle(file, FileTimeToSystemT...

How can I use bash (grep/sed/etc) to grab a section of a logfile between 2 timestamps?

I have a set of mail logs: mail.log mail.log.0 mail.log.1.gz mail.log.2.gz each of these files contain chronologically sorted lines that begin with timestamps like: May 3 13:21:12 ... How can I easily grab every log entry after a certain date/time and before another date/time using bash (and related command line tools) without compar...

Why my eclipse [on vista] shows incorrect file modification timestamp?

When I right-click on a recently modified file (like a jar generated by Java Builder) and view the file properties, the modification timestamp is always off by 2.5 hrs. Windows explorer, on the other hand, is showing correct timestamp. I suspect that their some time zone setting in eclipse somewhere that is used in translating the file...

php timestamp problem

Hello, i have a "simple" problem with the PHP timestamp (on a linux machine). I need to get the user birthdate in year-month-date (using 3 menus - html select). When the user is born on 1970-1-1 the timestamp is zero and the application logic gets everything wrong. How would you deal with this case? Regards, ...

Easy to use time-stamps in Python

I'm working on a journal-type application in Python. The application basically permits the user write entries in the journal and adds a time-stamp for later querying the journal. As of now, I use the time.ctime() function to generate time-stamps that are visually friendly. The journal entries thus look like: Thu Jan 21 19:59:47 2010 Di...

Converting NTFS timestamps to FAT Timestamps

Hello world! I'm writing a file transfer application, and I need to copy files from NTFS to FAT drives. Reading from http://support.microsoft.com/kb/127830, I understand that a time such as #11/29/2004 7:31:06 PM, 250ms# should get translated to #11/29/2004 7:31:08 PM, 0ms# when copying to a FAT hard drive. However, what actually happen...

Matlab time stamps reading

Any easy way to read all the columns in Matlab? my format is date time y1 y2 y3 y4 ......................... 4/27/2010 00:3:09 34 45 45 56 ................ so on currently i am reading these with the code [c,pathc]=uigetfile({'*.txt'},'Select the data','C:\Data'); file=[pathc c]; data= dlmread...

unix timestamps and php

I have a list of unix timestamps in a database, and I wanting to select the ones that are from today. i.e If today is Tueday, I want to get all the timestamps that were made today? Is it possible? Is there such a things as strtotime("Today")? Any help would be great ...

How does my php function for converting a date to facebook timestamp look? New to PHP.

any suggestions to make it better? function convertToFBTimestamp($date){ $this_date = date('Y-m-d-H-i-s', strtotime($date)); $cur_date = date('Y-m-d-H-i-s'); list ($this_year, $this_month, $this_day, $this_hour, $this_min, $this_sec) = explode('-',$this_date); list ($cur_year, $cur_month, $cur_day, $cur_hour, $cur_min, $cur_sec) = expl...

How to search for lines in a file between two timestamps using Perl?

In Perl I am trying to read a log file and will print only the lines that have a timestamp between two specific times. The time format is hh:mm:ss and this is always the third value on each log. For example, I would be searching for lines that would fall between 12:52:33 to 12:59:33 I am new to Perl and have no idea which route to tak...

timespamp convert php

How do I convert the standard php timestamp e.g. 1278184362 into this format 2010-07-03 19:00:00 ? needs to be exact... Any ideas guys? ...

Time Stamps, Qplot and strptime in R.

This is a follow up question as hadley pointed out unless I fix the problem with the time stamps the graphs I produce would be incorrect. With this in mind I am working towards fixing the issues I am having with the code. So far I have from my earlier questions that have been answered stopped using the attach() function in favour of usin...

Timezone/DST agnostic timestamps with NSDate

I'm creating objects which will be sent to a server, and I'm trying to ensure I account for timezone and Daylight Savings issues, so I want my timestamps to be "seconds since 1970" regardless of timezone, etc. Is [NSDate timeintervalSinceReferenceDate] sufficient for this? In the docs I know it says time since January 1 1970 00:00:00 GM...

Regex to extract timestamp from a text in PHP

Hey guys, I have the following bit of text (or some similar variation of it): Recurring Event First start: 2010-09-16 17:00:00 EDT Duration: 4800 Event Status: confirmed I need to select the timestamp of the "First Start" field and the duration. Normally I would split the string at the colons, but since the tim...

Is there a way to retroactively create time/node based UUID in PHP?

Most time-based (type 1) UUIDs are created using the current time. I'm migrating a MySQL database to cassandra and would like to create timebased UUIDs for archived items. Can someone provide an example of how type-1 UUIDs are created using past time periods? ...