Main Menu

Shoutbox

Baggey

2025-09-24, 17:57:11
They'll be using Expanding foam to glue bricks together next  :-X

Dabzy

2025-09-24, 06:09:52
You can also get the expanding foam post fix, but, I wouldnt trust it really, especially where I live on the side of a valley and when the storms blow in the right direction, whistling down the valley, nowt is safe!

Baggey

2025-09-23, 08:53:01
That Postcrete stuff is amazing. I never know how much water to add. May be i should read the Instructions  ;D 

Dabzy

2025-09-22, 21:33:46
Cannot beat a breaky uppy mode, saves the hand cramps and chipped knuckles knocking ten bells out of a chod of conc with a hammer and chisel.

GfK

2025-09-22, 21:28:44
I have a massive JCB drill with a concrete breaky uppy mode which has got me out of jail free a couple of times replacing rotted fence posts that has been concreted in.

Amon

2025-09-22, 19:23:30
What about Roly?

Dabzy

2025-09-22, 19:22:35
Putting my 2 deckings in.... I've dug enough post holes to last me a life time... I feel sorry for the future poor sod who may want to shift'em... Like most things I do, I tend to go over the top, and as such, I've probably got shares in postcrete! :D

GfK

2025-09-22, 19:10:57
Round is a shape.

Baggey

2025-09-22, 19:04:49
Consult a qualified electrician for compliance with BS 7671 and local building Regs! Avoid areas where future digging is likely. ;)

Jackdaw

2025-09-22, 18:18:24
That depends on where the cable is to run. Minimum depth in a garden in 450mm. Under pavements 600mm.

Members
  • Total Members: 55
  • Latest: Amon
Stats
  • Total Posts: 1,608
  • Total Topics: 198
  • Online today: 12
  • Online ever: 54 (Sep 14, 2025, 08:48 AM)
Users Online
  • Users: 0
  • Guests: 11
  • Total: 11
Welcome to SyntaxBoom. Please login or sign up.

Recent

wrong millisecond value, correct millisecond value

Started by RemiD, Jun 15, 2025, 10:09 AM

Previous topic - Next topic

RemiD

;wrong millisecond value, correct millisecond value 20180327
;on some computers with Windows 10, millisecs() returns a wrong millisecond value, this should get a correct millisecond value

Graphics3D(640,360,32,2)

Global NormalMil% = MilliSecs()
Global FixMil% = FixMilli()

Main()

End()

Function Main()

 Repeat

  If( KeyHit(28)=1 )
   NormalMil = MilliSecs()
   FixMil = FixMilli()
  EndIf

  SetBuffer(BackBuffer())
  ClsColor(000,000,000) : Cls()

  Color(250,250,250)
  TStr$ = NormalMil : Text(GraphicsWidth()/2-StringWidth(TStr)/2,0,TStr)
  TStr$ = FixMil : Text(GraphicsWidth()/2-StringWidth(TStr)/2,15,TStr)

  Flip(1)

 Until( KeyDown(1)=1 )

End Function

Function FixMilli%()

 Return MilliSecs() And $7FFFFFFF ; fix suggested by TomToad

End Function

Baggey

@remid I ran the code on my windows 10 Pc and im getting "213688282"
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad

RemiD

the problem only happens on some computers... not sure why...

Midimaster

You forgot to tell us the "wrong" value. Maybe it is the wellknown 32bit overrun problem which happens on long running computers?

Milliseconds reports a 32bit INTEGER value and when the timer increases over $7F FF FF FF after 24 days run of windows BlitzMax reports a negative number. You can expand this to 48 days, when you transfer the bytes to a LONG variable. And with a little calculation you can expand this to endless time. But it remain the problem of the moment when your app start shortly before $FFFFF000 and during the run the timer jumps back to 0 after $FFFFFFFF

RemiD

we already discussed about this issue on syntaxbomb.com...

QuoteSame result than with the Blitz3d millisecs() function :
On 2 computers with Windows 7, it returns the correct value (the 2 milliseconds values of the 2 functions are the same)
But on the computer with Windows 10, it returns a negative value (around -508100000) (the computer has just been started... and it was not in sleep mode)

those who need this fix will find it.

(unfortunately waybackmachine does not give us access to all threads / posts of syntaxbomb.com...)

Krischan

#5
Maybe it's an unusual workaround but what about using the continous UNIX timestamp value from OS and a timer instead of Millisecs? The Unix time is consistent and the Milliseconds timer gets reset every second and is added to the Unix timestamp.

Here is a simple example, you can either use it with the Milliseconds or if seconds are sufficient use the Unix timestamp only:

SuperStrict

Framework brl.systemdefault
Import brl.timerdefault
Import brl.polledinput
Import brl.StandardIO
Import brl.glmax2d

Graphics 800,600

Global unixtimer:TTimer=CreateTimer(1000)
Global unixtemp:Long

While Not KeyHit(KEY_ESCAPE)
	
	Cls
	DrawText UnixMillisecs(True),0,0
	DrawText UnixMillisecs(False),0,15
	Flip
	
Wend

End

' --------------------------------------------------------------------------------------------
' get the UNIX Milliseconds since 01/01/1970
' --------------------------------------------------------------------------------------------
Function UnixMillisecs:Long(usems:Int=True)

	Local add:String
	
	If unixtemp<>GetUnixTimeStamp() Then
	
		unixtemp=GetUnixTimeStamp()
		StopTimer unixtimer
		unixtimer=CreateTimer(1000)
	
	EndIf
	
	If usems Then add=String(unixtimer.ticks() Mod 1000)
		
	Return Long(GetUnixTimeStamp()+add)

End Function

' --------------------------------------------------------------------------------------------
' get current UNIX timestamp from OS
' --------------------------------------------------------------------------------------------
Function GetUnixTimeStamp:Long()

	Local time:Long[256]
	time_(time)
	Return time[0]

End Function

It should even ignore the Year 2038 problem, you can check this if you change the last line to Return time[0]+2^31
Kind regards

Krischan

Win11: Core i9 Ultra 285K, Nvidia RTX 5080, 64GB
Win10: Core i7 9700K, RTX 2080, 64GB
Amiga 500, MC68000, Agnus, 512K Chip + 512K Fast
C64, MOS 6510, VIC-II, 64K

Krischan's Blitzbasic archive