Time / Date Tracking

Started by
0 comments, last by Tonic151 21 years, 4 months ago
Hi, Well i've never tried this, so i figured i'd get some info on the best technique for Time/Date Tracking... I'm going to be reading a bunch of log files with time and date stamps in them.. I want to pick out the time and date, and sort each Log line by day.. then seperate by each day of the month. And also have options to purge after x amount of days. Anways is there is easy way to go about this, the courius problem i was thinking i was going to run into for example: if i keep track of statistics, and have it where the "end user" can set how many days they would like the program to keep track of everything for.. example 7 days.. and it starts off on 11/28/02 and goes till 12/05/02, whould I have to make my own calander to keep track of the roll over for each month. Or is there something that already does this?? I'm also trying to think of the best way to store the date and time in a struct.. for comparision and subtracting / dividing time... any suggestions would help a lot.. i'm trying to keep this cross platform for linux as well... [edited by - tonic151 on December 3, 2002 5:20:29 PM]
Advertisement
I don''t know if there is such a thing as a calender or something, but the best way to store date in my opinion is unix style. It''s used in databases.

(from MySQL documentation)

TIMESTAMP(14) YYYYMMDDHHMMSS
TIMESTAMP(12) YYMMDDHHMMSS
TIMESTAMP(10) YYMMDDHHMM
TIMESTAMP(8) YYYYMMDD
TIMESTAMP(6) YYMMDD
TIMESTAMP(4) YYMM
TIMESTAMP(2) YY

You can then format your date the way you want to show it to your player.

Hope this helps.

This topic is closed to new replies.

Advertisement