Author Topic: 32 hour clock  (Read 4666 times)

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« on: 23 August 2002, 13:23 »
would it be hard to make a 32 hour clock. I know little C++ (i can write the hello world program!), but i want to write a program for a 32 hour clock. I am by no means a programmer yet, which would be the best language to use for a clock, C++ i would assume?
I would go and learn the bare minimum to build a 32 hour clock if i new that it wasnt extremely hard. Now not knowing anything about time or programming i dont know if it would be extremely hard. COuld someone enlighten me?

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
32 hour clock
« Reply #1 on: 23 August 2002, 13:59 »
Code: [Select]

Here's a 32 hour clock I just whipped up.  It would probably have a considerable amount of drift though so if accuracy is what you need, don't use this code.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #2 on: 23 August 2002, 14:03 »
meh. I need something that vaguely follows 32 hour time. Now called Bob-time.
I will know how much drift it has because every 4th day of bob-time starts at the same time as one of your 24 hour days.

Hmmmmmm, easy. I think i am gettin the hang of some of this programmin stuff after reading lots o stuff over the past few weeks.

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #3 on: 23 August 2002, 14:18 »
uhh...
Code: [Select]
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
32 hour clock
« Reply #4 on: 23 August 2002, 14:31 »
Uh, try "gcc clock.c".  It's C not C++.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #5 on: 23 August 2002, 14:34 »
i tried that because i figured that and it did:
Code: [Select]
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
32 hour clock
« Reply #6 on: 23 August 2002, 14:40 »
You must not have copy/pasted it correctly. Either that your your system is *incredibly* screwed. This is about the most basic program there is and should compile without a single warning or error.

Maybe you can copy/paste the code back in to a message and let me see if anything is screwed.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #7 on: 23 August 2002, 14:43 »
i guess i did copy and paste it wrong.
teh clock is working, but i am gonna have to start it at 8 am... 2 hours, damn i guess i am gonna stay up all night... nevermind i already have stayed up all night.

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
32 hour clock
« Reply #8 on: 23 August 2002, 14:52 »
Heh heh, well you might want to add "day", "month", and "year" variables and the code to update them. Just follow the same logic as I did for second, minute, hour.  You might also add a snippet at the top so when you start it, it will sync with the current time from the system clock, but convert and initialize all the time variables to the time it would be on your 32 hour clock/calendar.

[ August 23, 2002: Message edited by: VoidMain ]

Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #9 on: 23 August 2002, 15:31 »
ummm... is there something special that i have to put down if i want a number to stay the same in the 'else' part?
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
32 hour clock
« Reply #10 on: 23 August 2002, 15:42 »
Uh, I don't understand what you mean.
Someone please remove this account. Thanks...

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #11 on: 23 August 2002, 15:47 »
my additions:
Code: [Select]
those two bolded parts are what i meant above.

how would i print the day and year?
does the day and year stuff iadded look okay?
shit... i forgot to change it so the days go back to zero after 273
#include <stdio.h>
#include <unistd.h>
int main() {
          int second;
            int minute;
              int hour;
                int day;
                  int days;
                    int year;
              second=0;minute=0;hour=0;day=6;days=199;year=2002;
              while(1) {
                      if (second==59) {
                              second=0;
                              if (minute==59) {
                                      minute=0;
                                      if (hour==31) {
                                              hour=0;
                                                if (day==7) {
                                                        day=1;
                                                      if (hour!=31) {
                                                                 days=days;
                                                              if (days==272) {
                                                                           year++;
                                                              } else {
                                                                      year=year
                                                             
                                                      } else {
                                                              days++;
                                              } else {
                                                      day++;
                                              }
                                      } else {
                                              hour++;
                                      }
                              } else {
                                      minute++;
                              }
                      } else {
                              second++;
                      }
                      sleep(1);
                      printf("%0.2d:%0.2d:%0.2d 2d.2d \r",hour,minute,second,day,year);
                      fflush(0);
              }
}
[/CODE]
those two bolded parts are what i meant above.

how would i print the day and year?
does the day and year stuff iadded look okay?
shit... i forgot to change it so the days go back to zero after 273

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

[ August 23, 2002: Message edited by: Master of Reality / Bob ]

Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

smokey

  • Member
  • **
  • Posts: 183
  • Kudos: 0
32 hour clock
« Reply #12 on: 23 August 2002, 16:10 »
nice - a 32 hr day would be a change from the boring old 24hr day  :D

I figured it out

In a 32hr Day there would be
 - 45 seconds in a minute
 - 60 minutes in an hour
 - 32 hours in a day

 - 2700 seconds in an hour as opposed to a 24hr day's 3600 seconds in an hour.

Now all I need to do is write a 12hr/24hr time to a 16hr/32hr time converter  :D .
//this is how I was born :)

cat /dev/urandom > /dev/mybrain

Tip for win98 (l)users: type copy /con/con in your command prompt to increase stability


Gooseberry Clock

  • Member
  • **
  • Posts: 419
  • Kudos: 0
    • http://redrangersoftware.cjb.net/
32 hour clock
« Reply #13 on: 23 August 2002, 16:13 »
Just write a script that converts the current time into Bob time.

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
32 hour clock
« Reply #14 on: 23 August 2002, 16:16 »
Code: [Select]
that will give
year, day (of year), hour, minute, seconds
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'