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%
 12%  [ 1 ]
1µs
0%
 0%  [ 0 ]
10µs
0%
 0%  [ 0 ]
100µs
0%
 0%  [ 0 ]
1ms
50%
 50%  [ 4 ]
10ms
12%
 12%  [ 1 ]
100ms
12%
 12%  [ 1 ]
1s
12%
 12%  [ 1 ]
>1s
0%
 0%  [ 0 ]
Total Votes : 8

Author
Thread Post new topic Reply to topic
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
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

Adam Kachwalla
Post 22 Sep 2006, 11:37
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
Adam Kachwalla wrote:
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

Adam Kachwalla

See timestamp function in Fasm for Dos source code.
Post 22 Sep 2006, 12:04
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17658
Location: In your JS exploiting you and your system
revolution
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.
Post 22 Sep 2006, 12:11
View user's profile Send private message Visit poster's website Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
The amount of segments in a day, depends on needs. Smile
Post 22 Sep 2006, 12:43
View user's profile Send private message Reply with quote
YONG



Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
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! Razz

YONG
Post 23 Sep 2006, 07:02
View user's profile Send private message Visit poster's website Reply with quote
Niels



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

useR
org 0xDEAD

Life_Start:
db 'Buzz Lightyear',0
call Heaven
jmp Life_Start
Post 23 Sep 2006, 13:55
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
Adam Kachwalla, try to use google for finding julian to gregorian and gregorian to julian time conversion (this comes from unix AFAIK)
Post 23 Sep 2006, 15:04
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Post 23 Sep 2006, 16:10
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Post 23 Sep 2006, 16:13
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
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.
Post 23 Sep 2006, 16:18
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
Time is an agreement. Smile
Post 23 Sep 2006, 16:21
View user's profile Send private message Reply with quote
YONG



Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
Niels wrote:
@YONG, you mean dead like this Smile

useR
org 0xDEAD

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


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

YONG
Post 25 Sep 2006, 13:02
View user's profile Send private message Visit poster's website Reply with quote
Niels



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

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 Smile. 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.
Post 25 Sep 2006, 18:58
View user's profile Send private message Reply with quote
YONG



Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
Niels wrote:
@YONG, Who knows? (GOD does) Smile

Perhaps. But I believe in atheism! Surprised

YONG
Post 26 Sep 2006, 12:34
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
YONG 永?
Post 26 Sep 2006, 13:38
View user's profile Send private message Visit poster's website Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
@YONG, I would be too, if GOD's name were Atheis. Smile
But atheism is the longest path to meet GOD.
Post 26 Sep 2006, 14:47
View user's profile Send private message Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
For the record: Atheism is not a or the path to k'no'w GOD. Smile
Post 26 Sep 2006, 14:52
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 559
smiddy
Adam Kachwalla wrote:
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

Adam Kachwalla


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.
Post 27 Sep 2006, 04:00
View user's profile Send private message Reply with quote
YONG



Joined: 16 Mar 2005
Posts: 8000
Location: 22° 15' N | 114° 10' E
YONG
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. Cool

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

@Niels: I respect your view. Smile

YONG
Post 27 Sep 2006, 12:29
View user's profile Send private message Visit poster's website Reply with quote
Niels



Joined: 17 Sep 2006
Posts: 255
Niels
@YONG, Ok, let's us forget the sidetrack and continue on Adam's subject. Smile
Post 27 Sep 2006, 19:37
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.