Show current date without using system timer

This is a discussion on Show current date without using system timer within the C Programming forums, part of the General Programming Boards category; Originally Posted by Kennedy swoopy, please tell me you are just joking and you really know what is a PMOS. ...

  1. #16
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Quote Originally Posted by Kennedy
    swoopy, please tell me you are just joking and you really know what is a PMOS. . .

    EDIT: Does knowing what PMOS is mean that I'm old?
    No, actually it probably means you're a EE.

  2. #17
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    269
    Hehe...pm OS , Protected Mode Operating System (the ones using CPU in protected mode). I think this is more clear

  3. #18
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Quote Originally Posted by fnoyan
    Hehe...pm OS , Protected Mode Operating System (the ones using CPU in protected mode). I think this is more clear
    Ok, thanks for the clarification fnoyan. I tried google for pm OS, and didn't have much luck. And from what you're saying, accesssing the BIOS may be a problem, starting with windows NT and up.

    I would think if the OP has the C stadard library, he could simply use that. As Quzah hinted, the question is vague.

  4. #19
    Registered User
    Join Date
    Sep 2006
    Posts
    3

    i'm back

    Quote Originally Posted by Salem
    Don't forget to say which Operating system / compiler / application type you're creating.
    The program run on 386 40Mhz (embedded tiny board), test on PC DOS 7.01 with Turbo c++ 3.0 compiler.
    Here is one of the code i have test...

    Code:
    #include <stdio.h>
    #include <dos.h>
    
    main()
    {
      clrscr();
      while(!kbhit())
      {
      unsigned char day,month;
      unsigned int year;
      union REGS regin,regout;
      regin.h.ah=0x2A;
      intdos(&regin,&regout);
      day=regout.h.dl;
      month=regout.h.dh;
      year=regout.x.cx;
      printf("The date %d-%d-%d\r",day,month,year);
      }
    return 0;
    }
    While i using this code, it really give me what i want. But when the program run in looping for a while(about 10 min), the date will increased by one day and the increment keep going on

  5. #20
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by swoopy
    Hmm, I did not know they made such an animal. The guy who invented it must be a genius.
    ...who doesn't know how to count to 24.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  6. #21
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,588
    > the date will increased by one day and the increment keep going on
    If you quit the program and restart it, is the date back to normal (for a while), or is it permanently wrong?

    I can't think of anything off-hand to explain it.

    If you're doing serious DOS low-level work, you definitely need this
    http://www.cs.cmu.edu/afs/cs.cmu.edu...WWW/files.html
    or a handy online version
    http://www.ctyme.com/rbrown.htm
    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.

  7. #22
    Registered User
    Join Date
    Sep 2006
    Posts
    3

    date keep going on

    Quote Originally Posted by Salem
    > If you quit the program and restart it, is the date back to normal (for a while), or is it permanently wrong?
    Hi bro, if i quit the program and restart it, the date still got error(date increment) unless i restart the OS (DOS) and the date back to normal.

    I have to put the code in looping because i need to do some data logging which included the date.

    i'm setup the timer interrupt follows the guide from

    http://www.inversereality.org/files/timerinterrupt.pdf and
    http://www.beyondlogic.org/interrupts/interupt.htm

    The interrupt working well as i expected. But in order to retrive the date without using system timer, some effort need to be put in...

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. FAQ: How do i display current time and date ?
    By davie_scotland in forum FAQ Board
    Replies: 2
    Last Post: 01-24-2002, 10:18 AM
  2. Help! I need to know how to use the system date!
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-17-2001, 10:20 PM
  3. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 01:26 PM
  4. how to pull system time, date, etc from <ctime>
    By Matt in forum C++ Programming
    Replies: 1
    Last Post: 09-25-2001, 09:08 AM
  5. System Date
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 08-28-2001, 06:03 PM

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