localtime_s not working in VS2003

This is a discussion on localtime_s not working in VS2003 within the Windows Programming forums, part of the Platform Specific Boards category; Hey guys. I am not a c++ programmer but i am trying to compile a code and i get this: ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    1

    localtime_s not working in VS2003

    Hey guys. I am not a c++ programmer but i am trying to compile a code and i get this:

    c:\Documents and Settings\HP_Administrator\Desktop\arcemu\src\arcem u-world\BattlegroundMgr.cpp(1072): error C3861: 'localtime_s': identifier not found, even with argument-dependent lookup

    I made a few search and found out localtime_s works only for VS2005+

    Can somewone show me how i can work arround that beside changing my application lol

    Code:
    1070 t = time(NULL);
    1071
    1072 #ifdef WIN32
    1073	localtime_s(&tm, &t);
    1074 #else
    1075	localtime_r(&t, &tm);
    1076 #endif
    Last edited by Drisate; 08-12-2008 at 08:55 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    So do you have localtime_r ?

    localtime_r after all is supposed to be a standard function. I've no idea what the _s is for, except to glue yourself to MS
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I think localtime_s is MS's 'secure' version. Unless you are writing software for an anti-virus company or some other company that requires tight security I can't think of a good reason to use the 'secure' versions. I know that some companies require you to due to the nature of their business.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function not working
    By sloopy in forum C Programming
    Replies: 31
    Last Post: 11-12-2005, 07:08 PM
  2. Program Not working Right
    By raven420smoke in forum C++ Programming
    Replies: 2
    Last Post: 09-16-2005, 03:21 AM
  3. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM
  4. x on upper right corner not working
    By caduardo21 in forum Windows Programming
    Replies: 1
    Last Post: 02-20-2005, 07:35 PM
  5. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21