flat assembler
Message board for the users of flat assembler.

 Index > OS Construction > Seconds To Time Goto page 1, 2  Next

What resolution should the time ticks be?
<1µs  12%  [ 1 ]
1µs  0%  [ 0 ]
10µs  0%  [ 0 ]
100µs  0%  [ 0 ]
1ms  50%  [ 4 ]
10ms  12%  [ 1 ]
100ms  12%  [ 1 ]
1s  12%  [ 1 ]
>1s  0%  [ 0 ]

Author

Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla 22 Sep 2006, 11:37
I want to convert the number of Seconds (eg. 1039182) from 1/1/1600 0:00:00 to a date (eg. 3/1/2000 19:20:10). Can anyone tell me how to do this (Yes: I have been scouring the net for more than 2 weeks)

I need an algorithm to convert the system time from a date with an epoch of 1/1/1600 0:00:00.000000

Help is greatly appreciated

22 Sep 2006, 11:37
Octavio

Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 22 Sep 2006, 12:04
I want to convert the number of Seconds (eg. 1039182) from 1/1/1600 0:00:00 to a date (eg. 3/1/2000 19:20:10). Can anyone tell me how to do this (Yes: I have been scouring the net for more than 2 weeks)

I need an algorithm to convert the system time from a date with an epoch of 1/1/1600 0:00:00.000000

Help is greatly appreciated

See timestamp function in Fasm for Dos source code.
22 Sep 2006, 12:04
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 19096
revolution 22 Sep 2006, 12:11
Windows uses a resolution of 100ns (10 million ticks per second) and uses 64 bits variables to keep the current time. Thus giving up to ~30000 years until overflow into 2^63. Windows also uses the same epoch you mention.

As for the algorithm, you can use such constants as 146097 days in each 400 year section, 1461 days in each 4 year section. Remember that each 100 years has no leap day except years divisible by 400 that do have the normal leap day. I don't have a ready made alogrithm but I think it should be quite simple to construct as a programming exercise.

Aside: time periods over 400 years have never been defined. So calculation based on the above may become meaningless as the clock shifts a little bit each 400 year cycle, ie. in the future some time there might be a day here and there added/deleted to keep in sync. Although, this is probably mostly academic since we all will most probably be long dead before such actions are required.
22 Sep 2006, 12:11
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 22 Sep 2006, 12:43
The amount of segments in a day, depends on needs.
22 Sep 2006, 12:43
YONG

Joined: 16 Mar 2005
Posts: 7997
Location: 22° 15' N | 114° 10' E
YONG 23 Sep 2006, 07:02
revolution wrote:
Although, this is probably mostly academic since we all will most probably be long dead before such actions are required.

We will, of course, be dead by then, but our FASM programs may live forever!

YONG
23 Sep 2006, 07:02
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 23 Sep 2006, 13:55
@YONG, you mean dead like this

useR

Life_Start:
db 'Buzz Lightyear',0
call Heaven
jmp Life_Start
23 Sep 2006, 13:55
Vasilev Vjacheslav

Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav 23 Sep 2006, 15:04
Adam Kachwalla, try to use google for finding julian to gregorian and gregorian to julian time conversion (this comes from unix AFAIK)
23 Sep 2006, 15:04
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 23 Sep 2006, 16:10
23 Sep 2006, 16:10
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 23 Sep 2006, 16:13
23 Sep 2006, 16:13
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 23 Sep 2006, 16:18
http://www.timeanddate.com/date/leapyear.html

Quote:
None of the calendars used today are perfect, they go wrong by seconds, minutes, hours or days every year.
23 Sep 2006, 16:18
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 23 Sep 2006, 16:21
Time is an agreement.
23 Sep 2006, 16:21
YONG

Joined: 16 Mar 2005
Posts: 7997
Location: 22° 15' N | 114° 10' E
YONG 25 Sep 2006, 13:02
Niels wrote:
@YONG, you mean dead like this

useR

Life_Start:
db 'Buzz Lightyear',0
call Heaven
jmp Life_Start

Well, I said "LIVE forever", not "RUN forever"!

YONG
25 Sep 2006, 13:02
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 25 Sep 2006, 18:58
@YONG, Who knows? (GOD does)

http://www.mcmanis.com/chuck/robotics/projects/lab-x3/lcd1.html

Quote:
Lack of divide makes it more difficult but we can do it the old fashioned way, subtracting . This project actually helped in a couple of ways, one it let me re-use some Z80 code from back in the day, and two it gave me an opportunity to check out the macro language in MPASM 5.x.
25 Sep 2006, 18:58
YONG

Joined: 16 Mar 2005
Posts: 7997
Location: 22° 15' N | 114° 10' E
YONG 26 Sep 2006, 12:34
Niels wrote:
@YONG, Who knows? (GOD does)

Perhaps. But I believe in atheism!

YONG
26 Sep 2006, 12:34
shoorick

Joined: 25 Feb 2005
Posts: 1613
Location: Ukraine
shoorick 26 Sep 2006, 13:38
YONG 永？
26 Sep 2006, 13:38
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 26 Sep 2006, 14:47
@YONG, I would be too, if GOD's name were Atheis.
But atheism is the longest path to meet GOD.
26 Sep 2006, 14:47
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 26 Sep 2006, 14:52
For the record: Atheism is not a or the path to k'no'w GOD.
26 Sep 2006, 14:52
smiddy

Joined: 31 Oct 2004
Posts: 557
smiddy 27 Sep 2006, 04:00
I want to convert the number of Seconds (eg. 1039182) from 1/1/1600 0:00:00 to a date (eg. 3/1/2000 19:20:10). Can anyone tell me how to do this (Yes: I have been scouring the net for more than 2 weeks)

I need an algorithm to convert the system time from a date with an epoch of 1/1/1600 0:00:00.000000

Help is greatly appreciated

Hi,

My suggestion is to look up Julian Algorithms and Gregorian Calendar. I found several sites with the math to do nearly what you want. I am using the epoch of Julian Day 0 of Monday, January 1, 4713 BC. This is essentially what is used for astronomical calculations for events. I used the FPU to do the calculation I needed. If you want I can share, but I need a few days to clean it up, it is pretty ugly and not ready for prime time.
27 Sep 2006, 04:00
YONG

Joined: 16 Mar 2005
Posts: 7997
Location: 22° 15' N | 114° 10' E
YONG 27 Sep 2006, 12:29
shoorick wrote:
YONG 永？

@shoorick: YES and NO.

YES: "yong" is the Putonghua (Mandarin) pronunciation of the Chinese word "永".

NO: I'm a Hongkonger. My native language is Cantonese. "YONG" is the Cantonese pronunciation of a different Chinese word, which is just another strange word to you since you're not familiar with the Chinese Language - so I'm not going to talk about it.

Niels wrote:
For the record: Atheism is not a or the path to k'no'w GOD.

YONG
27 Sep 2006, 12:29
Niels

Joined: 17 Sep 2006
Posts: 255
Niels 27 Sep 2006, 19:37
@YONG, Ok, let's us forget the sidetrack and continue on Adam's subject.
27 Sep 2006, 19:37
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area
Goto page 1, 2  Next

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum