Stop Microsoft
Miscellaneous => Programming & Networking => Topic started by: Master of Reality 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 ]
-
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.
-
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 ]
-
uhh...
-
Uh, try "gcc clock.c". It's C not C++.
-
i tried that because i figured that and it did:
-
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.
-
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 ]
-
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 ]
-
ummm... is there something special that i have to put down if i want a number to stay the same in the 'else' part?
-
Uh, I don't understand what you mean.
-
my additions:
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 ]
-
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 .
-
Just write a script that converts the current time into Bob time.
-
that will give
year, day (of year), hour, minute, seconds
-
http://forum.fuckmicrosoft.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=7&t=000431 (http://forum.fuckmicrosoft.com/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=7&t=000431)
-
its now:
2002:199:00:02:08
-
Not to put this topic off-topic, but MOR is being a heretic(again). Learning how to program C is something that requires INTELLECT and BRAINS. When you join Bob you choose to lose those abilties in order to achieve a utopia.
-
for compiling I usually find a standard 'make filenamewithout.c-or.cpp' to work well, for instance:
there is a file named test.cpp i want to compile
make test
I find the other way to lead to a lot more errors (at least in my cases).
-
Stryker, "make" is not a compiler, it's a project management utility that requires a "Makefile" (make script) which calls the compiler (such as gcc). It determines which files in your project need to be compiled and which are up to date. For a small single file program you just call the compiler directly, although you could create a Makefile for it, but that is an extra step not really needed for an example like this.. If the project grew into multiple source/header/library files then yes, you would want to create a Makefile and use "make" to manage the project.
[ August 23, 2002: Message edited by: VoidMain ]
-
It does NOT require a Makefile to be executed. You can add the parameter of a target file to compile, it will work with a single-file project (excluding #includes). I copied your source to test.cpp and then did 'make test' and it compiled just fine. I am aware that it is just a shortcut to the gcc goodies, but it gets the job done.
-
I know what "make" is, I've only been using it for 10+ years. But what I said is exactly true, it's designed to manage projects. Yes, you can give it a source file as a parameter and it will call the appropriate compiler (assuming it is set up correctly, which in Linux it is by default) but I maintain for someone just starting they should learn from the basic level on up. "make" is a great thing and you will definitely need it as you progress into larger programs but for someone who has never programmed they should know what the "compiler" is. I didn't mean to offend you by the way, if that is what I did.
-
I was offended at first, I thought you were trying to invalidate my post. It does have some value to it, and after you have the knowledge of how to compile things properly, then go ahead and use whatever method you like. I am just trying to show someone an easier route (easier is an opinion I know). But then again, I was reading and posting without sleep for 39 hours, I tend to take things the wrong way in such circumstances.
-
you may as well write a 2 or 3 line makefile though if you have a few programs in the same folder that will require the same options, yes?
-
M0R, You should get XINETD to host a time server on your webserver, but have it feed the output of this 32 hour time program to it instead of normal time.
It will have too be set first!
Maybe we should make this a sourceforge project?
This one asks for the current time: (And does not work)
It gives me
quote:
gterm:[qb]
/tmp/cckFTqJM.o: In function `main':
/tmp/cckFTqJM.o(.text+0x40): undefined reference to `inputf'
/tmp/cckFTqJM.o(.text+0x5e): undefined reference to `inputf'
/tmp/cckFTqJM.o(.text+0x7c): undefined reference to `inputf'
/tmp/cckFTqJM.o(.text+0x9a): undefined reference to `inputf'
/tmp/cckFTqJM.o(.text+0xb8): undefined reference to `inputf'
collect2: ld returned 1 exit status[/qb
What do i do now (im used to iostream.h not stdio.h)
[ August 24, 2002: Message edited by: Ex Eleven / b0b ]
-
Ahh, what the hell.
32 hour time? Does this mean I don't have to stay at school for as long as I do? If so, I'm adopting it. Yep. Go on and build a timeserver for it.
Oh, I'm a Windows Use-
STOP 0x4H KMODE_EXCEPTION_NOT_HANDLED (http://tongue.gif)
-
So how hard is it to set up a stream server for xinetd
-
XInetD? Why not make your own (it'd probably be easier)
-
Its now in C++
-
Does it matter whether it's in C or C++? Is there a performance change?
-
All we need now is a translator from Bob > Classic, Classic > Bob. Personnally, i dont see why us bobs need timing. But still this is good!
-
quote:
Originally posted by The Angel Of Death:
Does it matter whether it's in C or C++? Is there a performance change?
There is but not one noticeable on todays coputers, C++ is object orientated, c is not.
I learned C++ from "C++ for dummies" (the name suits me)
-
Well, now it makes sense - is your cult Anti-DCMA by the way? :confused:
-
quote:
Originally posted by Ex Eleven / b0b:
All we need now is a translator from Bob > Classic, Classic > Bob.
That might be a bit difficult seeing as the year is now 8 hours longer.
[ August 24, 2002: Message edited by: * Red Ranger Software * / Blob ]
-
its not really time for the Bobs, I just couldnt think of a name for the time scheme. We could calibrate the time by resetting it at 0:00 (normal + 32hour time) every four days when the two different days start at 0:00.
-
I guess you could. How about symetrical months
Have 8 Months a year
That means a month goes for 34.125 days
But then we have a leap year 6 years and then we have a time system. As for a conversion program i got this far and then stuck:
So its not finished because i can't quite figure the year bit.
If i find a host that has CGI-BIN and i can use cgi.h to write cgi apps in C/C++ and we could put a converter on the web.
-
we can have 13 months with 21 days (exactly) in each one. The beginning of every fourht year will have 3 extra days holidays that we will use to take an extra long bender after the new year.
-
Sounds good, anyway i need help with a translator (anyone)???
-
*** Hello. Welcome to the online English to Dutch translator. What would you like to translate?
-
Hmm cos i suck at maths somone just give my an algorithum in Flow chart form i will write an app
-
Maybe you should have stayed awake in math class? (http://smile.gif)
-
he was asleep in class because they forced him to conform to the evil 24 hour clock...
also, X11, that book, C++ for dummies, i saw that in the bookshop last month, but did not buy it because the CD that came with it was windows only. is this the same book? is it windows only? also, i think the same went for the idiot's guide to C++. How the fuck can they have fucking windows books for a unix programming language? that's the bollocks of being portable! you get walked all over.
Can anybody recommend a widespread starter book of this type for me that will ignore windows and concentrate on unix? what about one of the 'Sam's learn *** in 24 hours' books? do you think?
-
quote:
Originally posted by Calum:
he was asleep in class because they forced him to conform to the evil 24 hour clock...
also, X11, that book, C++ for dummies, i saw that in the bookshop last month, but did not buy it because the CD that came with it was windows only. is this the same book? is it windows only? also, i think the same went for the idiot's guide to C++. How the fuck can they have fucking windows books for a unix programming language? that's the bollocks of being portable! you get walked all over.
Can anybody recommend a widespread starter book of this type for me that will ignore windows and concentrate on unix? what about one of the 'Sam's learn *** in 24 hours' books? do you think?
Learn C in 24 hours, Learn C in 21 days are my first C programming books.
Also, I read Learn C++ in 21 days. I prefer the 24 hours ones, they usually get to the point.
oh, and X11...
shouldn't that be "std::cout" or have "using std::cout" in the beggining?
Edited typos
[ August 29, 2002: Message edited by: TheQuirk ]
-
quote:
Originally posted by Calum:
he was asleep in class because they forced him to conform to the evil 24 hour clock...
also, X11, that book, C++ for dummies, i saw that in the bookshop last month, but did not buy it because the CD that came with it was windows only. is this the same book? is it windows only? also, i think the same went for the idiot's guide to C++. How the fuck can they have fucking windows books for a unix programming language? that's the bollocks of being portable! you get walked all over.
Can anybody recommend a widespread starter book of this type for me that will ignore windows and concentrate on unix? what about one of the 'Sam's learn *** in 24 hours' books? do you think?
The CD comes with the Gnu C Compiler "gcc" and it works on MS-DOS (its DJGPP) unless there is a new version. But it is Free Software on the CD so you could get it anyway... all Linux distro's come with the compilers.
So get it its good!
-
making it a sourceforge product might be a good idea. I am plannin' to by some C and C++ books soon (very soon). I have fallen assbackward into a lil' cash (its hard being an unemployed student).