Thread: about timestamp

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    about timestamp

    Hello everyone,


    I need to record a set of data items. For each data item, users may modify to some new content. So, I plan to use a timestamp field for each data item to record the time when user modifies data item last time.

    I am not sure whether I should use a simple integer value (like version information, which increase 1 each time when user modifies data item)?

    Which approach is better? What are the advantages and disadvantages of each approach?


    thanks in advance,
    George

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Which approach is better? What are the advantages and disadvantages of each approach?
    Unfortunately, your question is very vague. Which is better depends heavily on how you plan to use that data. Can you be more specific?
    My best code is written with the delete key.

  3. #3
    Registered User Rennor's Avatar
    Join Date
    Aug 2006
    Location
    Finland
    Posts
    45
    If youre planning on going for full versio-control of changes, I'd suggest you use both, timestamp and integer value that increments on every change.

    Then implement the "real" data to have that integer value as 0, each modification goes to new identity.

    So, iterating few changes:

    Code:
    Stamp            VIdentity Data
    ===================================
    NULL             0        Newest data
    2006-08-16 11:00 1        foo
    2006-08-16 11:01 2        Second newest data
    What you benefit from this?
    You can have primary ID for your data that is in relation with other data, say you have dynamic list of Rooms and People and youre storing up data where and when were who.

    Just keep the VIdentity matching. This ofcourse means that you get ALOT of data between two lists since each modification escalates the row count while the row count is large.

    Did I make any sense?

    My apologies, I see into your question in highly database-point of view way. It's quite common that some database designs have change history within the tables/relations to track down all changes.

    Also, make sure to store value of "who" made the change, if that's available and you can run around accusing those who foobared your data

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unix Timestamp Creation
    By lavinpj1 in forum C Programming
    Replies: 3
    Last Post: 03-08-2009, 10:40 PM
  2. newbie needs help with code
    By compudude86 in forum C Programming
    Replies: 6
    Last Post: 07-23-2006, 08:54 PM
  3. access timestamp
    By Jalabert in forum Windows Programming
    Replies: 2
    Last Post: 06-02-2005, 08:02 AM
  4. making a timestamp
    By karmatic in forum C Programming
    Replies: 6
    Last Post: 04-11-2003, 10:05 PM
  5. convert integer unix timestamp to time
    By rotis23 in forum C Programming
    Replies: 2
    Last Post: 11-18-2002, 09:20 AM