# Something I learned about the CPU clock

**URL:** <https://forums.sifive.com/t/something-i-learned-about-the-cpu-clock/2635>\
**Category:** Freedom E300\
**Created:** [July 14, 2019, 9:44pm UTC](https://forums.sifive.com/t/something-i-learned-about-the-cpu-clock/2635 "2019-07-14T21:44:17Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![DanaK6JQ](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@DanaK6JQ](https://forums.sifive.com/u/DanaK6JQ)\
**Post date:** [December 21, 2019, 11:25pm UTC](https://forums.sifive.com/t/something-i-learned-about-the-cpu-clock/2635/8 "2019-12-21T23:25:03Z")

</div>

If you’re still interested, I think this other post of mine might help

> [@How to get/set CPU clock frequency for HiFive1 Rev. B?](http://forums.sifive.com/t/how-to-get-set-cpu-clock-frequency-for-hifive1-rev-b/2335/4):
>
> @ckuehnel if you’re still looking for an example, I believe this might help - I’ll explain the testing I’ve done below slight_smile #include \<metal/machine.h\> long cpu\_clock; cpu\_clock = metal\_clock\_get\_rate\_hz(&\_\_metal\_dt\_clock\_4.clock); new\_cpu\_clock = metal\_clock\_set\_rate\_hz(&\_\_metal\_dt\_clock\_4.clock, 32000000L); The magic there is “&\_\_metal\_dt\_clock\_4.clock”, have a look at bsp/install/include/metal/machine/inline.h for others I’m pretty-sure this is correct, I tried it on a Spa…

Cheers,  
Dana

---

_[View the full topic](https://forums.sifive.com/t/something-i-learned-about-the-cpu-clock/2635)._
