Film Canon
In the film adaptation, Hogwarts has an enormous Clock Tower in the centre of the main courtyard. It seems to chime on the hour and half-hour throughout the day
Book canon
They have clocks on the walls
The following week dragged by. Wednesday night found Hermione and
Harry sitting alone in the common room, long after everyone else had
gone to bed. The clock on the wall had just chimed midnight when the
portrait hole burst open. Ron appeared out of nowhere as he pulled off
Harry’s Invisibility Cloak. He had been down at Hagrid’s hut, helping
him feed Norbert, who was now eating dead rats by the crate.HP:Philosopher's Stone - Chapter 14
and upright clocks
‘No, no, no,’ said Hermione. ‘No, we’re not. Why don’t you go to bed,
Neville?’ Harry looked at the grandfather clock by the door. They
couldn’t afford to waste any more time, Snape might even now be
playing Fluffy to sleep. HP:Philosopher's Stone - Chapter 16
Presumably these clocks are literally clockwork, which wouldn't be affected by magic restrictions on electronics.
Our three heroes wear wrist-watches
‘Nearly six,’ said Ron, checking his watch and then staring down the
drive which led to the front gates. ‘How d’you reckon they’re coming?
The train?’
Harry crept past them to the portrait hole and waited for a minute or
so, keeping an eye on his watch. Then Hermione opened the Fat Lady for
him from outside as they had planned. He slipped past her with a
whispered ‘Thanks!’ and set off through the castle.
Hermione was tugging at his sleeve, staring at her watch. ‘We’ve got
exactly ten minutes to get back down to the hospital wing without
anybody seeing us – before Dumbledore locks the door’
For the record, there may be magical watches (Dumbledore seems to have one) but the rest of the characters seem to rely on mundane clocks and wristwatches, all of which seem to work fine inside Hogwarts:
Professor McGonagall pulled out a lace handkerchief and dabbed at her
eyes beneath her spectacles. Dumbledore gave a great sniff as he took
a golden watch from his pocket and examined it. It was a very odd
watch. It had twelve hands but no numbers; instead, little planets
were moving around the edge. It must have made sense to Dumbledore,
though, because he put it back in his pocket and said, ‘Hagrid’s late.
I suppose it was he who told you I’d be here, by the way?’
Peeves will tell you the time if you're unlucky
Peeves cackled.
‘Wandering around at midnight, ickle firsties? Tut, tut, tut. Naughty, naughty, you’ll get caughty.’
The portraits can also tell you the time in a limited fashion
By the time he got up to the portrait of the Fat Lady and pulled off his Invisibility Cloak, he was not surprised to find her in a most unhelpful mood.
‘What sort of time do you call this?’
‘I’m really sorry – I had to go out for something important –’
‘Well, the password changed at midnight, so you’ll just have to sleep in the corridor, won’t you?’